Documentation ¶
Overview ¶
XDG Base Directory Specification
Index ¶
- Constants
- Variables
- type XDGBaseDirSpec
- func (x *XDGBaseDirSpec) CacheHome() string
- func (x *XDGBaseDirSpec) ConfigDirs() []string
- func (x *XDGBaseDirSpec) ConfigHome() string
- func (x *XDGBaseDirSpec) DataDirs() []string
- func (x *XDGBaseDirSpec) DataHome() string
- func (x *XDGBaseDirSpec) DefaultCacheHome() string
- func (x *XDGBaseDirSpec) DefaultConfigDirs() []string
- func (x *XDGBaseDirSpec) DefaultConfigHome() string
- func (x *XDGBaseDirSpec) DefaultDataDirs() []string
- func (x *XDGBaseDirSpec) DefaultDataHome() string
- func (x *XDGBaseDirSpec) DefaultRuntimeDir() string
- func (x *XDGBaseDirSpec) RuntimeDir() string
- func (x *XDGBaseDirSpec) UserHomeDir() string
Constants ¶
const ( EnvXDGConfigHome = "XDG_CONFIG_HOME" EnvXDGDataHome = "XDG_DATA_HOME" EnvXDGCacheHome = "XDG_CACHE_HOME" EnvXDGRuntimeDir = "XDG_RUNTIME_DIR" EnvXDGConfigDirs = "XDG_CONFIG_DIRS" EnvXDGDataDirs = "XDG_DATA_DIRS" )
Variables ¶
var ErrInvalidUser = errors.New("invalid user")
Functions ¶
This section is empty.
Types ¶
type XDGBaseDirSpec ¶
type XDGBaseDirSpec struct {
// contains filtered or unexported fields
}
func NewXDG ¶
func NewXDG() (*XDGBaseDirSpec, error)
NewXDG returns a new XDGBaseDirSpec instance for the current user.
func NewXDGWithUser ¶
func NewXDGWithUser(user *user.User) (*XDGBaseDirSpec, error)
NewXDGWithUser returns a new XDGBaseDirSpec instance for the given user.
func NewXDGWithUsername ¶
func NewXDGWithUsername(username string) (*XDGBaseDirSpec, error)
NewXDGWithUsername returns a new XDGBaseDirSpec instance for the given username. When the user does not exist, an error is returned.
func (*XDGBaseDirSpec) CacheHome ¶
func (x *XDGBaseDirSpec) CacheHome() string
func (*XDGBaseDirSpec) ConfigDirs ¶
func (x *XDGBaseDirSpec) ConfigDirs() []string
func (*XDGBaseDirSpec) ConfigHome ¶
func (x *XDGBaseDirSpec) ConfigHome() string
func (*XDGBaseDirSpec) DataDirs ¶
func (x *XDGBaseDirSpec) DataDirs() []string
func (*XDGBaseDirSpec) DataHome ¶
func (x *XDGBaseDirSpec) DataHome() string
func (*XDGBaseDirSpec) DefaultCacheHome ¶
func (x *XDGBaseDirSpec) DefaultCacheHome() string
DefaultCacheHome returns the default cache directory for the user, i.e. ~/.cache.
func (*XDGBaseDirSpec) DefaultConfigDirs ¶
func (x *XDGBaseDirSpec) DefaultConfigDirs() []string
DefaultConfigDirs returns the default configuration directories for the user.
func (*XDGBaseDirSpec) DefaultConfigHome ¶
func (x *XDGBaseDirSpec) DefaultConfigHome() string
DefaultConfigHome returns the default configuration directory for the user, i.e. ~/.config.
func (*XDGBaseDirSpec) DefaultDataDirs ¶
func (x *XDGBaseDirSpec) DefaultDataDirs() []string
DefaultDataDirs returns the default data directories for the user.
func (*XDGBaseDirSpec) DefaultDataHome ¶
func (x *XDGBaseDirSpec) DefaultDataHome() string
DefaultDataHome returns the default data directory for the user, i.e. ~/.local/share.
func (*XDGBaseDirSpec) DefaultRuntimeDir ¶
func (x *XDGBaseDirSpec) DefaultRuntimeDir() string
DefaultRuntimeDir returns the default runtime directory for the user. This is the directory where user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. In systemd-based systems, systemd-logind(8) will create and manage this directory for the user.
func (*XDGBaseDirSpec) RuntimeDir ¶
func (x *XDGBaseDirSpec) RuntimeDir() string
func (*XDGBaseDirSpec) UserHomeDir ¶
func (x *XDGBaseDirSpec) UserHomeDir() string
UserHomeDir returns the home directory of the user.