Documentation
¶
Overview ¶
Package file Filesystem related utilities
Index ¶
- Variables
- func CopyFile(dst string, src io.Reader) (n int64, err error)
- func DetermineResourcePath(staticDir string, resourceDir string, devDir string) (string, error)
- func InitDataDir(dir string) (string, error)
- func LoadJSON(filename string, thing interface{}) error
- func ResolveResourceDirectory(path string) string
- func SaveBinary(filename string, data []byte, mode os.FileMode) error
- func SaveJSON(filename string, thing interface{}, mode os.FileMode) error
- func SaveJSONSafe(filename string, thing interface{}, mode os.FileMode) error
- func UserHome() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyDirectoryName is returned by constructing the full path // of data directory if the passed argument is empty ErrEmptyDirectoryName = errors.New("data directory must not be empty") // ErrDotDirectoryName is returned by constructing the full path of // data directory if the passed argument is "." ErrDotDirectoryName = errors.New("data directory must not be equal to \".\"") )
Functions ¶
func DetermineResourcePath ¶
DetermineResourcePath DEPRECATE
func InitDataDir ¶
InitDataDir Joins dir with the user's $HOME directory. If $HOME cannot be determined, uses the current working directory. dir must not be the empty string
func ResolveResourceDirectory ¶
ResolveResourceDirectory searches locations for a research directory and returns absolute path
func SaveBinary ¶
SaveBinary persists data into given file in binary, backup the previous file, if there was one
func SaveJSONSafe ¶
SaveJSONSafe saves json to disk, but refuses if file already exists
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.