github.com/artpar/rclone@v1.67.3/backend/local/metadata_other.go (about)

     1  //go:build dragonfly || plan9 || js
     2  
     3  package local
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"time"
     9  
    10  	"github.com/artpar/rclone/fs"
    11  )
    12  
    13  // Read the time specified from the os.FileInfo
    14  func readTime(t timeType, fi os.FileInfo) time.Time {
    15  	return fi.ModTime()
    16  }
    17  
    18  // Read the metadata from the file into metadata where possible
    19  func (o *Object) readMetadataFromFile(m *fs.Metadata) (err error) {
    20  	info, err := o.fs.lstat(o.path)
    21  	if err != nil {
    22  		return err
    23  	}
    24  	m.Set("mode", fmt.Sprintf("%0o", info.Mode()))
    25  	m.Set("mtime", info.ModTime().Format(metadataTimeFormat))
    26  	return nil
    27  }