Documentation ¶
Overview ¶
Package filesystem provides functionality for interacting with directories and files in a cross-platform manner.
Index ¶
- Constants
- func DeleteAllTempFiles() error
- func DeleteSpacemeshDataFolders(t *testing.T)
- func EnsureSpacemeshDataDirectories() (string, error)
- func GetAccountsDataDirectoryPath() (string, error)
- func GetCanonicalPath(p string) string
- func GetFullDirectoryPath(name string) (string, error)
- func GetLogsDataDirectoryPath() (string, error)
- func GetSpacemeshDataDirectoryPath() (string, error)
- func GetSpacemeshTempDirectoryPath() (string, error)
- func GetUserHomeDirectory() string
- func PathExists(path string) bool
- func SetupTestHooks(users map[string]*user.User)
- func TearDownTestHooks()
- func TestUsers() map[string]*user.User
Constants ¶
const OwnerReadWrite = 0600
OwnerReadWrite is a standard owner read / write file permission.
const OwnerReadWriteExec = 0700
OwnerReadWriteExec is a standard owner read / write / exec file permission.
Variables ¶
This section is empty.
Functions ¶
func DeleteAllTempFiles ¶
func DeleteAllTempFiles() error
DeleteAllTempFiles deletes all temp files from the temp dir and creates a new temp dir.
func DeleteSpacemeshDataFolders ¶
DeleteSpacemeshDataFolders deletes all sub directories and files in the Spacemesh root data folder.
func EnsureSpacemeshDataDirectories ¶
EnsureSpacemeshDataDirectories return the os-specific path to the Spacemesh data directory. It creates the directory and all predefined sub directories on demand.
func GetAccountsDataDirectoryPath ¶
GetAccountsDataDirectoryPath returns the path to the accounts data directory. It will create the directory if it doesn't already exist.
func GetCanonicalPath ¶
GetCanonicalPath returns an os-specific full path following these rules:
- replace ~ with user's home dir path
- expand any ${vars} or $vars
- resolve relative paths /.../
Where p: source path name
func GetFullDirectoryPath ¶
GetFullDirectoryPath gets the OS specific full path for a named directory. The directory is created if it doesn't exist.
func GetLogsDataDirectoryPath ¶
GetLogsDataDirectoryPath returns the path to the app logs data directory. It will create the directory if it doesn't already exist.
func GetSpacemeshDataDirectoryPath ¶
GetSpacemeshDataDirectoryPath gets the full os-specific path to the spacemesh top-level data directory.
func GetSpacemeshTempDirectoryPath ¶
GetSpacemeshTempDirectoryPath gets the spacemesh temp files dir so we don't have to work with convoluted os specific temp folders.
func GetUserHomeDirectory ¶
func GetUserHomeDirectory() string
GetUserHomeDirectory returns the current user's home directory if one is set by the system.
func PathExists ¶
PathExists returns true if file exists in local store and is accessible.
func SetupTestHooks ¶
SetupTestHooks sets current user to mock user to test
Types ¶
This section is empty.