Documentation
¶
Index ¶
- func DirExists(path string) (bool, error)
- func EmptyDir(path string) error
- func EnsureDir(path string) error
- func EnsureDirAll(path string) error
- func FileExists(path string) (bool, error)
- func FindInPaths(paths []string, baseName string) string
- func GetHomeDirectory() string
- func GetIntraDir(pattern string, depth, length int) string
- func GetNameFromPath(path string, stripExtension bool) string
- func IsFsPathCaseSensitive(path string) (bool, error)
- func IsPathInDir(dir, pathToCheck string) bool
- func MatchExtension(path string, extensions []string) bool
- func RemoveDir(path string) error
- func SafeMove(src, dst string) error
- func SymWalk(path string, walkFn filepath.WalkFunc) error
- func Touch(path string) error
- func WriteFile(path string, file []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExists ¶
func DirExists(path string) (bool, error)
DirExists returns true if the given path exists and is a directory
func EmptyDir ¶
func EmptyDir(path string) error
EmptyDir will recursively remove the contents of a directory at the given path
func EnsureDir ¶
func EnsureDir(path string) error
EnsureDir will create a directory at the given path if it doesn't already exist
func EnsureDirAll ¶
func EnsureDirAll(path string) error
EnsureDirAll will create a directory at the given path along with any necessary parents if they don't already exist
func FileExists ¶
func FileExists(path string) (bool, error)
FileExists returns true if the given path exists and is a file. This function returns false and the error encountered if the call to os.Stat fails.
func FindInPaths ¶
func FindInPaths(paths []string, baseName string) string
FindInPaths returns the path to baseName in the first path where it exists from paths.
func GetHomeDirectory ¶
func GetHomeDirectory() string
GetHomeDirectory returns the path of the user's home directory. ~ on Unix and C:\Users\UserName on Windows
func GetIntraDir ¶
func GetIntraDir(pattern string, depth, length int) string
GetIntraDir returns a string that can be added to filepath.Join to implement directory depth, "" on error eg given a pattern of 0af63ce3c99162e9df23a997f62621c5 and a depth of 2 length of 3 returns 0af/63c or 0af\63c ( dependin on os) that can be later used like this filepath.Join(directory, intradir, basename)
func GetNameFromPath ¶
func GetNameFromPath(path string, stripExtension bool) string
GetNameFromPath returns the name of a file from its path if stripExtension is true the extension is omitted from the name
func IsFsPathCaseSensitive ¶
func IsFsPathCaseSensitive(path string) (bool, error)
IsFsPathCaseSensitive checks the fs of the given path to see if it is case sensitive if the case sensitivity can not be determined false and an error != nil are returned
func IsPathInDir ¶
func IsPathInDir(dir, pathToCheck string) bool
IsPathInDir returns true if pathToCheck is within dir.
func MatchExtension ¶
func MatchExtension(path string, extensions []string) bool
MatchExtension returns true if the extension of the provided path matches any of the provided extensions.
func RemoveDir ¶
func RemoveDir(path string) error
RemoveDir removes the given dir (if it exists) along with all of its contents
func SafeMove ¶
func SafeMove(src, dst string) error
SafeMove attempts to move the file with path src to dest using os.Rename. If this fails, then it copies src to dest, then deletes src.
func SymWalk ¶
func SymWalk(path string, walkFn filepath.WalkFunc) error
SymWalk extends filepath.Walk to also follow symlinks
Types ¶
This section is empty.