Documentation ¶
Index ¶
- func DirFiles(dir string) ([]string, error)
- func DirsEqual(src, dst string) bool
- func ExpandPath(p string) (string, error)
- func FileExists(filename string) bool
- func HasDir(dirPath string) (bool, error)
- func HashDir(dir string) (string, error)
- func HomeDir() string
- func IpcEndpoint(ipcPath, datadir string) string
- func ReadFileAsBytes(filename string) ([]byte, error)
- func RecursiveFileFind(filename, dir string) (bool, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirFiles ¶
DirFiles returns list of files found within a given directory and its sub-directories. Directory prefix will not be included as a part of returned file string i.e. for a file located in "dir/foo/bar" only "foo/bar" part will be returned.
func ExpandPath ¶
ExpandPath given a string which may be a relative path. 1. replace tilde with users home dir 2. expands embedded environment variables 3. cleans the path, e.g. /a/b/../c -> /a/c Note, it has limitations, e.g. ~someuser/tmp will not be expanded
func FileExists ¶
FileExists returns true if a file is not a directory and exists at the specified path.
func HashDir ¶
HashDir calculates and returns hash of directory: each file's hash is calculated and saved along with the file name into the list, after which list is hashed to produce the final signature. Implementation is based on https://github.com/golang/mod/blob/release-branch.go1.15/sumdb/dirhash/hash.go
func IpcEndpoint ¶
ipcEndpoint resolves an IPC endpoint based on a configured value, taking into account the set data folders as well as the designated platform we're currently running on.
func ReadFileAsBytes ¶
ReadFileAsBytes expands a file name's absolute path and reads it as bytes from disk.
Types ¶
This section is empty.