appdir

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package appdir provides helpers to compose filenames to be used by applications.

Index

Constants

View Source
const (
	// PrefixLocal represent services installed outside
	// the scope of the package manager
	PrefixLocal = "/usr/local"
	// PrefixSystem represent services installed by
	// the package manager
	PrefixSystem = "/"
	// PrefixOptional represent services installed outside
	// the scope of the package manager but require
	// a complex hierarchy, usually installed extracting
	// an archive file.
	PrefixOptional = "/opt"
)
View Source
const PrefixUser = "~"

PrefixUser is the prefix used on SetSysPrefix to indicate SysFooDir() will return the same as UserFooDir()

Variables

This section is empty.

Functions

func AllConfigDir

func AllConfigDir(sub ...string) []string

AllConfigDir returns a slice containing the application configuration path on the current working directory, user mode, and system mode.

func Join

func Join(base string, sub ...string) string

Join combines file path parts in a OS specific way. parts are allowed to be multipart themselves, using `/` as delimiter.

func SetSysPrefix

func SetSysPrefix(dir string) error

SetSysPrefix specifies what filesystem prefix to use when generating SysFooDir() strings. Default is "~"

func SysCacheDir

func SysCacheDir(sub ...string) (string, error)

SysCacheDir returns where to store application cache, when run in system mode.

func SysConfigDir

func SysConfigDir(sub ...string) (string, error)

SysConfigDir returns where to store application configuration data, when run in system mode.

func SysDataDir

func SysDataDir(sub ...string) (string, error)

SysDataDir returns where to store application persistent data, when run in system mode.

func SysRuntimeDir

func SysRuntimeDir(sub ...string) (string, error)

SysRuntimeDir returns where to store application run-time variable data, when run in system mode.

func UserCacheDir

func UserCacheDir(sub ...string) (string, error)

UserCacheDir returns where to store application cache when run in user mode. ${XDG_CACHE_HOME}/...

func UserConfigDir

func UserConfigDir(sub ...string) (string, error)

UserConfigDir returns where to store application configuration, when run in user mode. ${XDG_CONFIG_HOME}/...

func UserDataDir

func UserDataDir(sub ...string) (string, error)

UserDataDir returns where to store application persistent data, when run in user mode. ${XDG_DATA_HOME}/...

func UserRuntimeDir

func UserRuntimeDir(sub ...string) (string, error)

UserRuntimeDir returns where to store application run-time variable data, when run in user mode. ${XDG_RUNTIME_DIR}/...

Types

This section is empty.

Jump to

Keyboard shortcuts

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