Documentation ¶
Index ¶
- func AppendToFile(path string, s ...string) error
- func CreateFile(path string) error
- func Ensure(_path string, dir bool) error
- func ExecDir() string
- func ExecPath() string
- func HomeDir() (string, error)
- func IsExist(_path string) (ok bool, err error)
- func MustExist(_path string) bool
- func OverwriteFile(path string, s ...string) error
- func ReadFile(path string) (string, error)
- func RemoveFile(path string, dir bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToFile ¶
AppendToFile appends the contents of s to the path file, each s ends with new line.
func CreateFile ¶
CreateFile creates the path file with mode 0666 (before umask), truncating it if it already exists. If there is an error, it will be of type *PathError.
func Ensure ¶
Ensure returns an error if the path of file or directory(dir is true) isn't existed or catches other error.
func ExecDir ¶
func ExecDir() string
ExecDir returns the directory path of the command-line program.
func IsExist ¶
IsExist returns boolean indicating whether the path of file or directory already exists. Returns an unknown error if not match some syscall errors.
func MustExist ¶
MustExist returns a boolean, it true if the path of file or directory already exists.
func OverwriteFile ¶
OverwriteFile overwrite the path file with the contents of s, each s ends with a new line.
func RemoveFile ¶
RemoveFile if dir then removes path and any children it contains, otherwise then removes the path file or directory.
Types ¶
This section is empty.