fileinfo_linux.go 325 字节
Newer Older
O
ob-robot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
//go:build linux
// +build linux

package file

import (
	"os"
	"syscall"
	"time"
)

func toFileInfoEx(info os.FileInfo) *FileInfoEx {
	sysInfo, _ := info.Sys().(*syscall.Stat_t)
	return &FileInfoEx{
		FileInfo:   info,
		fileId:     sysInfo.Ino,
		devId:      sysInfo.Dev,
		createTime: time.Unix(sysInfo.Ctim.Unix()),
	}
}