Documentation ¶
Index ¶
- Constants
- func AbsPaths(rootPath string, relPaths []string) []string
- func BackupFile(filepath string) error
- func DirsExist(paths ...string) error
- func FileExists(path string) bool
- func FileGlob(pattern string) ([]string, error)
- func FileReadLine(path string) (string, error)
- func FileSize(path string) (int64, error)
- func FindFileInParentDirs(startPath, filename string) (string, error)
- func FindFilesInSubDir(searchDir, filename string, maxdepth int) ([]string, error)
- func IsDir(path string) (bool, error)
- func IsFile(path string) (bool, error)
- func IsRegularFile(path string) (bool, error)
- func Mkdir(path string) error
- func PathsJoin(rootPath string, relPaths []string) []string
- func SameFile(a, b string) (bool, error)
Constants ¶
const FileBackupSuffix = ".bak"
Variables ¶
This section is empty.
Functions ¶
func BackupFile ¶
BackupFile renames a file to <OldName><FileBackupSuffix>.
func FileExists ¶
FileExists returns true if path exist and is a file
func FileGlob ¶
FileGlob resolves the pattern to absolute file paths. Files are resolved in the same way then filepath.Glob() does, with 2 Exceptions: - it also supports '**' to match files and directories recursively, - it only returns paths to files, no directory paths, If a globPath doesn't match any files an empty []string is returned and error is nil
func FileReadLine ¶
FileReadLine reads the first line from a file
func FindFileInParentDirs ¶
FindFileInParentDirs finds a file in startPath or its parent directories. The function starts looking for a file called filename in startPath and then checks recursively its parent directories. It returns the absolute path of the first match. If it reaches the root directory without finding the file it returns os.ErrNotExist.
func FindFilesInSubDir ¶
FindFilesInSubDir returns all directories that contain filename that are in searchDir. The function descends up to maxdepth levels of directories below searchDir
func IsDir ¶
IsDir returns true if the path is a directory. If the directory does not exist, the error from os.Stat() is returned.
func IsFile ¶
IsFile returns true if path is a file. If the path does not exist an error is returned
func IsRegularFile ¶
IsRegularFile returns true if path is a regular file. If the directory does not exist, the error from os.Stat() is returned.
Types ¶
This section is empty.