mirror of https://gitee.com/godoos/godoos.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
556 B
27 lines
556 B
//go:build linux
|
|
// +build linux
|
|
|
|
package office
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
func getFileInfoData(data *Document) (bool, error) {
|
|
fileinfo, err := os.Stat(data.path)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
data.Filename = fileinfo.Name()
|
|
data.Title = data.Filename
|
|
data.Size = int(fileinfo.Size())
|
|
|
|
stat := fileinfo.Sys().(*syscall.Stat_t)
|
|
data.Createtime = time.Unix(stat.Ctim.Sec, stat.Ctim.Nsec)
|
|
data.Modifytime = time.Unix(stat.Mtim.Sec, stat.Mtim.Nsec)
|
|
data.Accesstime = time.Unix(stat.Atim.Sec, stat.Atim.Nsec)
|
|
|
|
return true, nil
|
|
}
|
|
|