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.
44 lines
990 B
Go
44 lines
990 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package acp
|
|
|
|
import (
|
|
"fmt"
|
|
"io/fs"
|
|
"os"
|
|
)
|
|
|
|
type sysStat struct{}
|
|
|
|
func readSysStat(path string, stat fs.FileInfo) (*sysStat, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func truncate(file *os.File, size int64) error {
|
|
if err := file.Truncate(size); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func writeSysStat(name string, j *stat) error {
|
|
if err := os.Chmod(name, j.mode); err != nil {
|
|
return fmt.Errorf("chmod fail, %w", err)
|
|
}
|
|
if err := os.Chtimes(name, j.modTime, j.modTime); err != nil {
|
|
return fmt.Errorf("chtimes fail, %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func readSysStatWithContent(path string, info fs.FileInfo, bounded bool) (*sysStat, error) {
|
|
return readSysStat(path, info)
|
|
}
|
|
|
|
func nativeContentMetadata(j *stat) ContentMetadata { return ContentMetadata{Info: j.info} }
|
|
|
|
func contentStat(metadata ContentMetadata) *stat {
|
|
return &stat{info: metadata.Info, size: metadata.Info.Size(), mode: metadata.Info.Mode(), modTime: metadata.Info.ModTime()}
|
|
}
|