go-xdgbasedir ·
Trivially get XDG Base Directories in Golang.
Install
$ go get "github.com/srishanbhattarai/go-xdgbasedir"
Dependencies
This package depends on go-homedir.
Usage
import (
// other imports
"fmt"
xdg "github.com/srishanbhattarai/go-xdgbasedir"
)
func main() {
fmt.Println(xdg.Data())
// ..and so on.
}
API
All exported functions return a string
unless otherwise stated.
Data()
User's data files.
Config()
User's config files.
Cache()
Users' cache files.
Runtime()
User's runtime files.
DataDirs()
In addition to Data()
, the list of priority-first base dirs for data.
This returns an interface. You'll need to type cast it to a string or a string slice to get the results.
func main() {
dataDirs = xdg.DataDirs()
// Use it as follows
// dataDirs(.string)
}
ConfigDirs()
In addition to Config()
, the list of priority-first base dirs for configurations.
This returns an interface. You'll need to type cast it to a string or a string slice to get the results.
func main() {
configDirs = xdg.configDirs()
// Use it as follows
// configDirs(.string)
}
License
MIT ©