Files
acp/stat.go
T
Samuel Cui b5f28fa474 Release ACP v0.2.7
Add ordered content sources and targets to the shared copy pipeline. Observe
fs.File metadata before target creation, bind fs.FS sources, and expose
fatal-stop notification while preserving native copy behavior.
2026-10-15 18:18:39 +08:00

35 lines
793 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) {
return newStatWithContent(path, fi, false)
}
func newStatWithContent(path string, fi fs.FileInfo, bounded bool) (*stat, error) {
sysStat, err := readSysStatWithContent(path, fi, bounded)
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
}