Documentation
¶
Overview ¶
Package osutil provides some OS-level helper functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChmodExecutable ¶
ChmodExecutable sets the executable mode/flag on a file, if not already.
func ExpandHome ¶
ExpandHome expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is. Via https://github.com/mitchellh/go-homedir/blob/master/homedir.go
func FileExists ¶
FileExists returns whether or not a file exists on the filesystem. We consider any error returned by os.Stat to indicate that the file doesn't exist. We could be specific and use os.IsNotExist(err), but most other errors also indicate that the file isn't there (or isn't available) so we'll just catch them all.
func NormalizeCommand ¶
func NormalizeFilePath ¶
Normalizes a path and returns an clean absolute version. It correctly expands environment variables inside paths, converts "~/" into the users home directory, and replaces "./" with the current working directory.
func UserHomeDir ¶
UserHomeDir is similar to os.UserHomeDir, but prefers $HOME when available over other options (such as USERPROFILE on Windows).
Types ¶
This section is empty.