mirror of
https://github.com/samuelncui/acp.git
synced 2026-11-08 12:27:05 +00:00
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.
31 lines
642 B
Go
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
|
|
}
|