Files
acp/stat.go
T
Samuel Cui 4d5dbd0b8c Release ACP v0.2.3
Simplify indexed copy facts and unify staged output completion.
Fix cleanup, rewrite persistence, native paths, and terminal reporting.
Maintain compatibility, upstream notices, and automated release checks.
2026-10-05 16:29:55 +08:00

31 lines
642 B
Go

package acp
import (
"fmt"
"io/fs"
"time"
)
type stat struct {
info fs.FileInfo // source facts collected once by indexing or enumeration
size int64 // length in bytes for regular files; system-dependent for others
mode fs.FileMode // file mode bits
modTime time.Time // modification time
sys *sysStat
}
func newStat(path string, fi fs.FileInfo) (*stat, error) {
sysStat, err := readSysStat(path, fi)
if err != nil {
return nil, fmt.Errorf("read sys stat failed, %w", err)
}
return &stat{
info: fi,
size: fi.Size(),
mode: fi.Mode(),
modTime: fi.ModTime(),
sys: sysStat,
}, nil
}