Documentation ¶
Index ¶
- func Dir(appName string, roaming bool) string
- func EnsureDir(fileName string)
- func FileExists(filePath string) bool
- func GetDataDir(goos, appName string, roaming bool) string
- func MinUint32(a, b uint32) uint32
- func PrependForWindows(args []string) []string
- func PrependForWindowsWithStart(args []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir returns an operating system specific directory to be used for storing application data for an application. The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice.
An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.
The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default. Example results:
dir := Dir("myapp", false) POSIX (Linux/BSD): ~/.myapp Mac OS: $HOME/Library/Application Support/Myapp Windows: %LOCALAPPDATA%\Myapp Plan 9: $home/myapp
func EnsureDir ¶
func EnsureDir(fileName string)
EnsureDir checks a file could be written to a path, creates the directories as needed
func FileExists ¶
FileExists reports whether the named file or directory exists.
func GetDataDir ¶
GetDataDir returns an operating system specific directory to be used for storing application data for an application. See Dir for more details. This unexported version takes an operating system argument primarily to enable the testing package to properly test the function by forcing an operating system that is not the currently one.
func MinUint32 ¶
MinUint32 is a helper function to return the minimum of two uint32s. This avoids a math import and the need to cast to floats.
func PrependForWindows ¶
PrependForWindows runs a command with a terminal
func PrependForWindowsWithStart ¶
PrependForWindowsWithStart runs a process independently
Types ¶
This section is empty.