Documentation ¶
Index ¶
- func AppSystemConfigDirs(ctx context.Context) []string
- func AppUserCacheDir(ctx context.Context) string
- func AppUserConfigDir(ctx context.Context) string
- func AppUserLogDir(ctx context.Context) string
- func UserCacheDir(ctx context.Context) string
- func UserConfigDir(ctx context.Context) string
- func UserHomeDir(ctx context.Context) string
- func WithAppSystemConfigDirs(ctx context.Context, configDirs []string) context.Context
- func WithAppUserCacheDir(ctx context.Context, cacheDir string) context.Context
- func WithAppUserConfigDir(ctx context.Context, configDir string) context.Context
- func WithAppUserLogDir(ctx context.Context, logdir string) context.Context
- func WithGOOS(ctx context.Context, goos string) context.Context
- func WithUserHomeDir(ctx context.Context, home string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppSystemConfigDirs ¶
AppSystemConfigDirs returns a list of directories to search for application-specific (but not user-specific) configuration data.
On all platforms, this returns the list from SystemConfigDirs, with "/telepresence" appended to each directory (using the appropriate path separator, if not "/").
If the location cannot be determined, then it will return an error.
func AppUserCacheDir ¶
AppUserCacheDir returns the directory to use for application-specific user-specific cache data.
On all platforms, this returns "{{UserCacheDir}}/telepresence" (using the appropriate path separator, if not "/").
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func AppUserConfigDir ¶
AppUserConfigDir returns the directory to use for application-specific user-specific configuration data.
On all platforms, this returns "{{UserConfigDir}}/telepresence" (using the appropriate path separator, if not "/").
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func AppUserLogDir ¶
AppUserLogDir returns the directory to use for application-specific user-specific log files.
On Darwin, it returns "$HOME/Library/Logs/telepresence". Specified by: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html
On everything else, it returns "{{AppUserCacheDir}}/logs" (using the appropriate path separator, if not "/").
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func UserCacheDir ¶ added in v2.19.1
UserCacheDir returns the default root directory to use for user-specific cached data. Callers should create their own application-specific subdirectory within this one and use that (for example, using AppUserCacheDir).
On non-Darwin Unix systems, it returns "$XDG_CACHE_HOME" if non-empty, or else "$HOME/.cache". Specified by: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
On Darwin, it returns "$HOME/Library/Caches". Specified by: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html
On Windows, it returns "%LocalAppData%" (usually "C:\Users\%USERNAME%\AppData\Local").
On Plan 9, it returns "$home/lib/cache".
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func UserConfigDir ¶
UserConfigDir returns the default root directory to use for user-specific configuration data. Users should create their own application-specific subdirectory within this one and use that (for example, using AppUserConfigDir).
On non-Darwin Unix systems, it returns "$XDG_CONFIG_HOME" if non-empty, or else "$HOME/.config". Specified by: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
On Darwin, it returns "$HOME/Library/Application Support". Specified by: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html See also: https://github.com/golang/go/commit/b33652642286cf4c3fc8b10cdda97bd58059ba3e
On Windows, it returns "%AppData%" (usually "C:\Users\UserName\AppData\Roaming").
On Plan 9, it returns "$home/lib".
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func UserHomeDir ¶
UserHomeDir returns the current user's home directory.
On Unix, including macOS, it returns the $HOME environment variable.
On Windows, it returns the "%USERPROFILE%" environment variable.
On Plan 9, it returns the "$home" environment variable.
If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
func WithAppSystemConfigDirs ¶ added in v2.1.2
WithAppSystemConfigDirs spoofs the AppSystemConfigDirs. This is useful for testing.
func WithAppUserCacheDir ¶ added in v2.9.0
WithAppUserCacheDir spoofs the AppUserCacheDir. This is useful for testing.
func WithAppUserConfigDir ¶ added in v2.1.2
WithAppUserConfigDir spoofs the AppUserConfigDir. This is useful for testing.
func WithAppUserLogDir ¶
WithAppUserLogDir spoofs the AppUserLogDir. This is useful for testing, or for when logging to a normal user's logs as root.
Types ¶
This section is empty.