Documentation ¶
Index ¶
- Variables
- func Copy(opts CopyOptions) (err error)
- func EnsureRelDir(base, path string, perm os.FileMode) (string, error)
- func MakeAvailableDir(g StringIter) (string, error)
- func RenameToAvailableName(oldpath string, g StringIter) (string, error)
- func SameStat(a, b string) (bool, error)
- type CopyOptions
- type FileChanges
- type StringIter
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCopyOptions = CopyOptions{ SourceFlags: os.O_RDONLY | syscall.O_NOFOLLOW, SourceModePreserve: true, DestFlags: os.O_WRONLY | os.O_CREATE | os.O_TRUNC | syscall.O_NOFOLLOW, DestMode: 0o666, }
View Source
var ErrFileChanged = errors.New("file changed")
View Source
var ErrIterExhausted = errors.New("iterator exhausted")
Functions ¶
func Copy ¶
func Copy(opts CopyOptions) (err error)
Copy creates an exact file copy. The operation fails if the source file is modified concurrently.
func EnsureRelDir ¶
EnsureRelDir creates a directory if and only if it is a subdirectory of base. The base directory must exist. Path may be an absolute path.
On success the cleaned path to the created directory is returned.
If path does not resolve to a subdirectory of base the directory is not created and the function merely returns the path.
func MakeAvailableDir ¶
func MakeAvailableDir(g StringIter) (string, error)
func RenameToAvailableName ¶
func RenameToAvailableName(oldpath string, g StringIter) (string, error)
RenameToAvailableName attempts to rename oldpath to a path produced by g. The used destination path is returned.
Types ¶
type CopyOptions ¶
type FileChanges ¶
type FileChanges []string
func DescribeChanges ¶
func DescribeChanges(a, b os.FileInfo) FileChanges
DescribeChanges produces a list of changes detected between the two given FileInfo instances.
func (FileChanges) Empty ¶
func (c FileChanges) Empty() bool
func (FileChanges) Err ¶
func (c FileChanges) Err() error
type StringIter ¶
Click to show internal directories.
Click to hide internal directories.