filesystem

package
v0.0.0-...-42befb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package filesystem provides functionality for interacting with directories and files in a cross-platform manner.

Index

Constants

View Source
const OwnerReadWrite = 0600

OwnerReadWrite is a standard owner read / write file permission.

View Source
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

func DeleteSpacemeshDataFolders(t *testing.T)

DeleteSpacemeshDataFolders deletes all sub directories and files in the Spacemesh root data folder.

func EnsureSpacemeshDataDirectories

func EnsureSpacemeshDataDirectories() (string, error)

EnsureSpacemeshDataDirectories return the os-specific path to the Spacemesh data directory. It creates the directory and all predefined sub directories on demand.

func GetAccountsDataDirectoryPath

func GetAccountsDataDirectoryPath() (string, error)

GetAccountsDataDirectoryPath returns the path to the accounts data directory. It will create the directory if it doesn't already exist.

func GetCanonicalPath

func GetCanonicalPath(p string) string

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

func GetFullDirectoryPath(name string) (string, error)

GetFullDirectoryPath gets the OS specific full path for a named directory. The directory is created if it doesn't exist.

func GetLogsDataDirectoryPath

func GetLogsDataDirectoryPath() (string, error)

GetLogsDataDirectoryPath returns the path to the app logs data directory. It will create the directory if it doesn't already exist.

func GetSpacemeshDataDirectoryPath

func GetSpacemeshDataDirectoryPath() (string, error)

GetSpacemeshDataDirectoryPath gets the full os-specific path to the spacemesh top-level data directory.

func GetSpacemeshTempDirectoryPath

func GetSpacemeshTempDirectoryPath() (string, error)

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

func PathExists(path string) bool

PathExists returns true if file exists in local store and is accessible.

func SetupTestHooks

func SetupTestHooks(users map[string]*user.User)

SetupTestHooks sets current user to mock user to test

func TearDownTestHooks

func TearDownTestHooks()

TearDownTestHooks sets current user back

func TestUsers

func TestUsers() map[string]*user.User

TestUsers returns a map of users for testing

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL