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 EnsureDirAll ¶
EnsureDirAll will create a directory at the given path along with any necessary parents if they don't already exist
func FileExists ¶
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 ¶
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 ¶
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 ¶
GetNameFromPath returns the name of a file from its path if stripExtension is true the extension is omitted from the name
func IsFsPathCaseSensitive ¶
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 ¶
IsPathInDir returns true if pathToCheck is within dir.
func MatchExtension ¶
MatchExtension returns true if the extension of the provided path matches any of the provided extensions.
func SafeMove ¶
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.
Types ¶
This section is empty.