mirror of
https://github.com/samuelncui/acp.git
synced 2026-11-08 04:21:16 +00:00
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.
35 lines
793 B
Go
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
|
|
}
|