filelocation

package
v2.4.10-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppSystemConfigDirs

func AppSystemConfigDirs(ctx context.Context) ([]string, error)

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, error)

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, error)

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, error)

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 UserConfigDir

func UserConfigDir(ctx context.Context) (string, error)

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, error)

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