Documentation ¶
Index ¶
- Constants
- Variables
- func AppCacheDirOrDefault(defaultCacheDir string, toolName string) string
- func AppConfigDirOrDefault(defaultAppConfigDir string, toolName string) string
- func DedupeLinesInFiles(dir string) error
- func GetFiles(root string) ([]string, error)
- func HomeDirOrDefault(defaultDirectory string) string
- func IsUnixOS() bool
- func IsWindowsOS() bool
- func IsWritable(path string) bool
- func PrintStdDirs(toolName string)
- func SyncDirectory(source, destination string) error
- func UserConfigDirOrDefault(defaultConfigDir string) string
- type PathInfo
Constants ¶
const ( UnixPathSeparator = "/" WindowsPathSeparator = "\\" )
Variables ¶
var ( // Separator evaluated at runtime Separator = string(os.PathSeparator) // Remove source directory after successful sync RemoveSourceDirAfterSync = true )
Functions ¶
func AppCacheDirOrDefault ¶ added in v0.0.58
AppCacheDirOrDefault returns the user cache directory or defaultCacheDir in case of error
func AppConfigDirOrDefault ¶ added in v0.0.37
AppConfigDirOrDefault returns the app config directory
func DedupeLinesInFiles ¶ added in v0.0.93
DedupeLinesInFiles deduplicates lines in all files in a directory The function can be memory intensive for directories with large files.
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. It caches writable paths to avoid unnecessary file operations.
func PrintStdDirs ¶ added in v0.0.58
func PrintStdDirs(toolName string)
Prints the standard directories for a tool
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