xdg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

XDG Base Directory Specification

Index

Constants

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

View Source
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.

Jump to

Keyboard shortcuts

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