Documentation ¶
Overview ¶
Package xdg Light weight helper functions in golang to get config, data and cache files according to the XDG Base Directory Specification
Index ¶
- Constants
- Variables
- func AllConfigDirs() []string
- func AllDataDirs() []string
- func CacheHome() string
- func ConfigDirs() []string
- func ConfigHome() string
- func DataDirs() []string
- func DataHome() string
- func DesktopDir() string
- func DocumentsDir() string
- func DownloadDir() string
- func FindCacheFile(rel ...string) (string, error)
- func FindConfigFile(rel ...string) (string, error)
- func FindDataFile(rel ...string) (string, error)
- func FindRuntimeFile(rel ...string) (string, error)
- func MusicDir() string
- func PicturesDir() string
- func PublicShareDir() string
- func RuntimeDir() string
- func TemplatesDir() string
- func VideosDir() string
Constants ¶
const ( // ConfigHomeEnv is the name of the environment variable holding a user configuration directory path. ConfigHomeEnv = "XDG_CONFIG_HOME" // ConfigDirsEnv is the name of the environment variable holding system configuration directory paths. ConfigDirsEnv = "XDG_CONFIG_DIRS" )
const ( // DataHomeEnv is the name of the environment variable holding a user data directory path. DataHomeEnv = "XDG_DATA_HOME" // DataDirsEnv is the name of the environment variable holding system data directory paths. DataDirsEnv = "XDG_DATA_DIRS" )
const ( // DesktopDirEnv is the name of the environment variable holding a user desktop directory path. DesktopDirEnv = "XDG_DESKTOP_DIR" // DownloadDirEnv is the name of the environment variable holding a user download directory path. DownloadDirEnv = "XDG_DOWNLOAD_DIR" // DocumentsDirEnv is the name of the environment variable holding a user documents directory path. DocumentsDirEnv = "XDG_DOCUMENTS_DIR" // MusicDirEnv is the name of the environment variable holding a user music directory path. MusicDirEnv = "XDG_MUSIC_DIR" // PicturesDirEnv is the name of the environment variable holding a user pictures directory path. PicturesDirEnv = "XDG_PICTURES_DIR" // VideosDirEnv is the name of the environment variable holding a user videos directory path. VideosDirEnv = "XDG_VIDEOS_DIR" // TemplatesDirEnv is the name of the environment variable holding a user templates directory path. TemplatesDirEnv = "XDG_TEMPLATES_DIR" PublicShareDirEnv = "XDG_PUBLICSHARE_DIR" )
const (
// CacheHomeEnv is the name of the environment variable holding a cache directory path.
CacheHomeEnv = "XDG_CACHE_HOME"
)
const (
// RuntimeDirEnv is the name of the environment variable holding a runtime directory path.
RuntimeDirEnv = "XDG_RUNTIME_DIR"
)
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound indicates that a file cannot be found in any directory.
Functions ¶
func AllConfigDirs ¶
func AllConfigDirs() []string
AllConfigDirs returns all XDG configuration directories.
func ConfigDirs ¶
func ConfigDirs() []string
ConfigDirs returns system XDG configuration directories (XDG_CONFIG_DIRS).
func ConfigHome ¶
func ConfigHome() string
ConfigHome returns a user XDG configuration directory (XDG_CONFIG_HOME).
func DataDirs ¶
func DataDirs() []string
DataDirs returns system XDG data directories (XDG_DATA_DIRS).
func DesktopDir ¶ added in v1.2.0
func DesktopDir() string
func DocumentsDir ¶ added in v1.2.0
func DocumentsDir() string
func DownloadDir ¶ added in v1.2.0
func DownloadDir() string
func FindCacheFile ¶
FindCacheFile finds a file from the XDG data directory. If one cannot be found, an error `ErrNotFound` be returned.
func FindConfigFile ¶
FindConfigFile finds a file from the XDG configuration directory. If one cannot be found, an error `ErrNotFound` be returned.
func FindDataFile ¶
FindDataFile finds a file from the XDG data directory. If one cannot be found, an error `ErrNotFound` be returned.
func FindRuntimeFile ¶
FindRuntimeFile finds a file from the XDG runtime directory. If one cannot be found, an error `ErrNotFound` be returned.
func PicturesDir ¶ added in v1.2.0
func PicturesDir() string
func PublicShareDir ¶ added in v1.2.0
func PublicShareDir() string
func TemplatesDir ¶ added in v1.2.0
func TemplatesDir() string
Types ¶
This section is empty.