filelocation

package
v2.21.0-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppSystemConfigDirs

func AppSystemConfigDirs(ctx context.Context) []string

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

func AppUserCacheDir(ctx context.Context) string

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

func AppUserConfigDir(ctx context.Context) string

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

func AppUserLogDir(ctx context.Context) string

AppUserLogDir returns the directory to use for application-specific user-specific log files.

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

func UserCacheDir(ctx context.Context) string

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).

If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

func UserConfigDir

func UserConfigDir(ctx context.Context) string

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).

If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

func UserHomeDir

func UserHomeDir(ctx context.Context) string

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

func WithAppSystemConfigDirs(ctx context.Context, configDirs []string) context.Context

WithAppSystemConfigDirs spoofs the AppSystemConfigDirs. This is useful for testing.

func WithAppUserCacheDir added in v2.9.0

func WithAppUserCacheDir(ctx context.Context, cacheDir string) context.Context

WithAppUserCacheDir spoofs the AppUserCacheDir. This is useful for testing.

func WithAppUserConfigDir added in v2.1.2

func WithAppUserConfigDir(ctx context.Context, configDir string) context.Context

WithAppUserConfigDir spoofs the AppUserConfigDir. This is useful for testing.

func WithAppUserLogDir

func WithAppUserLogDir(ctx context.Context, logdir string) context.Context

WithAppUserLogDir spoofs the AppUserLogDir. This is useful for testing, or for when logging to a normal user's logs as root.

func WithGOOS

func WithGOOS(ctx context.Context, goos string) context.Context

WithGOOS spoofs the runtime.GOOS for all functions in this package. This is useful for testing, and should not be used in the normal code.

func WithUserHomeDir

func WithUserHomeDir(ctx context.Context, home string) context.Context

WithUserHomeDir spoofs the UserHomedir and all derived values for all functions in this package. This is useful for testing, and should not be used in the normal code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL