Documentation ¶
Index ¶
- func CreateByteFile(data []byte, fullpath string, allowOverwrite bool) error
- func CreateDirectory(dirname string) error
- func CreateEmptyFile(fullpath string, allowOverwrite bool) error
- func DirExists(dir string) bool
- func FileExists(name string) bool
- func ReadTillNul(b []byte) string
- func WriteJSONConfig(cfg interface{}, directory, fullpath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateByteFile ¶
CreateByteFile takes a slice of bytes & writes its contents to disk at fullpath using an io.Writer if the file does not already exist. If the file exists and allowOverwrite is true then it will overwrite the existing file.
func CreateDirectory ¶
CreateDirectory attempts to create a directory with given dirname if it does not already exist. If it already exists, then the function does nothing.
func CreateEmptyFile ¶
CreateEmptyFile wraps os.Create and creates and empty file with at fullpath if it does not exist. If the file at fullpath exists, and allowOverwrite is true then it will overwrite the existing file.
func FileExists ¶
FileExists returns true if the file of name exists; otherwise returns false.
func ReadTillNul ¶
ReadTillNul takes a slice of bytes b and reads up until it encounters the first null terminator, returning the bytes read up until that point as a string.
func WriteJSONConfig ¶
WriteJSONConfig takes an empty interface cfg, which is meant to be a *config.Config struct or a *GameList and writes it as JSON to disk at fullpath, overwriting any existing file.
Types ¶
This section is empty.