Documentation ¶
Overview ¶
Package files contains helper functions related to the file system.
Index ¶
- func CanonicalPath(path string, basePath string) (string, error)
- func CanonicalPaths(paths []string, basePath string) ([]string, error)
- func CopyFile(source string, destination string) error
- func FileExists(path string) bool
- func GetPathRelativeTo(path string, basePath string) (string, error)
- func Grep(regex *regexp.Regexp, glob string) (bool, error)
- func IsDir(path string) bool
- func ReadFileAsString(path string) (string, error)
- func WriteFileWithSamePermissions(source string, destination string, contents []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalPath ¶
Return the canonical version of the given path, relative to the given base path. That is, if the given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func CanonicalPaths ¶
Return the canonical version of the given paths, relative to the given base path. That is, if a given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func GetPathRelativeTo ¶
GetPathRelativeTo returns the relative path you would have to take to get from basePath to path. If either path or basePath are symbolic links, they will be evaluated before the relative path between them is calculated.
func Grep ¶
Returns true if the given regex can be found in any of the files matched by the given glob
func ReadFileAsString ¶
Return the contents of the file at the given path as a string
Types ¶
This section is empty.