Documentation ¶
Index ¶
- func CopyDir(src, dst string) error
- func EquivalentPaths(p1, p2 string) (bool, error)
- func HasFilepathPrefix(path, prefix string) (bool, error)
- func IsDir(name string) (bool, error)
- func IsNonEmptyDir(name string) (bool, error)
- func IsRegular(name string) (bool, error)
- func IsSymlink(path string) (bool, error)
- func RenameWithFallback(src, dst string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist.
func EquivalentPaths ¶ added in v0.3.1
EquivalentPaths compares the paths passed to check if they are equivalent. It respects the case-sensitivity of the underlying filesysyems.
func HasFilepathPrefix ¶
HasFilepathPrefix will determine if "path" starts with "prefix" from the point of view of a filesystem.
Unlike filepath.HasPrefix, this function is path-aware, meaning that it knows that two directories /foo and /foobar are not the same thing, and therefore HasFilepathPrefix("/foobar", "/foo") will return false.
This function also handles the case where the involved filesystems are case-insensitive, meaning /foo/bar and /Foo/Bar correspond to the same file. In that situation HasFilepathPrefix("/Foo/Bar", "/foo") will return true. The implementation is *not* OS-specific, so a FAT32 filesystem mounted on Linux will be handled correctly.
func IsNonEmptyDir ¶
IsNonEmptyDir determines if the path given is a non-empty directory or not.
func RenameWithFallback ¶
RenameWithFallback attempts to rename a file or directory, but falls back to copying in the event of a cross-device link error. If the fallback copy succeeds, src is still removed, emulating normal rename behavior.
Types ¶
This section is empty.