Documentation ¶
Index ¶
- func Abs(path string) string
- func Exists(path string) bool
- func IsDirectory(path string) bool
- func Mkdirp(path string) string
- func ReadTextFile(path string) (string, error)
- func Touch(path string, flags ...interface{}) string
- func WriteTextFile(path string, content string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
Returns the fully resolved path, even if the path does not exist.
``` fsutil.Abs("./does/not/exist") ``` If the code above was run within `/home/user`, the result would be `/home/user/does/not/exist`.
func IsDirectory ¶
IsDirectory determines whether the specified path represents a directory.
func Mkdirp ¶
Mkdirp is the equivalent of [mkdir -p](https://en.wikipedia.org/wiki/Mkdir) It will generate the full directory path if it does not already exist.
func ReadTextFile ¶
func Touch ¶
/ Similar to the touch command on *nix, where the file or directory will be created if it does not already exist. Returns the absolute path. The optional second boolean argument will force the method to treat the path as a file instead of a directory (useful when the filename has not extension). An optional 3rd boolean argument will force the method to treat the path as a directory even if a file extension is present.
For example: `fsutil.Touch("./path/to/archive.old", false, true)`
Normally, any file path with an extension is determined to be a file. However; the second argument (`false`) instructs the command to **not** force a file. The third argument (`true`) instructs the command to **treat the path like a directory**.
func WriteTextFile ¶
Types ¶
This section is empty.