Documentation
¶
Index ¶
- Constants
- Variables
- func AppConfigDirOrDefault(defaultAppConfigDir string, toolName string) string
- func GetFiles(root string) ([]string, error)
- func HomeDirOrDefault(defaultDirectory string) string
- func IsUnixOS() bool
- func IsWindowsOS() bool
- func IsWritable(path string) bool
- func SyncDirectory(source, destination string) error
- func UserConfigDirOrDefault(defaultConfigDir string) string
- type PathInfo
Constants ¶
const ( UnixPathSeparator = "/" WindowsPathSeparator = "\\" )
Variables ¶
var RemoveSourceDirAfterSync = true
Remove source directory after successful sync
var ( // Separator evaluated at runtime Separator = string(os.PathSeparator) )
Functions ¶
func AppConfigDirOrDefault ¶ added in v0.0.37
AppConfigDirOrDefault returns the app config directory
func HomeDirOrDefault ¶
HomeDirOrDefault tries to obtain the user's home directory and returns the default if it cannot be obtained.
func IsWindowsOS ¶
func IsWindowsOS() bool
func IsWritable ¶ added in v0.0.51
IsWritable checks if a path is writable by attempting to create a temporary file. Note: It's recommended to minimize the use of this function because it involves file creation. If performance is a concern, consider declaring a global variable in the module using this and initialize it once.
func SyncDirectory ¶ added in v0.0.41
SyncDirectory sync all files and non-empty directories from source to destination folder optionally removes source directory and removes source
func UserConfigDirOrDefault ¶ added in v0.0.37
UserConfigDirOrDefault returns the user config directory or defaultConfigDir in case of error