2024-04-18 15:36:22 +08:00
|
|
|
//go:build dragonfly || plan9 || js
|
2022-05-25 01:06:16 +08:00
|
|
|
|
|
|
|
package local
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-12-08 23:26:53 +08:00
|
|
|
"os"
|
|
|
|
"time"
|
2022-05-25 01:06:16 +08:00
|
|
|
|
|
|
|
"github.com/rclone/rclone/fs"
|
|
|
|
)
|
|
|
|
|
2023-12-08 23:26:53 +08:00
|
|
|
// Read the time specified from the os.FileInfo
|
|
|
|
func readTime(t timeType, fi os.FileInfo) time.Time {
|
|
|
|
return fi.ModTime()
|
|
|
|
}
|
|
|
|
|
2022-05-25 01:06:16 +08:00
|
|
|
// Read the metadata from the file into metadata where possible
|
|
|
|
func (o *Object) readMetadataFromFile(m *fs.Metadata) (err error) {
|
|
|
|
info, err := o.fs.lstat(o.path)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Set("mode", fmt.Sprintf("%0o", info.Mode()))
|
|
|
|
m.Set("mtime", info.ModTime().Format(metadataTimeFormat))
|
|
|
|
return nil
|
|
|
|
}
|