Documentation ¶
Overview ¶
xdg implements helpers for you to use the XDG spec in your apps.
For now, that's just the base directory spec, http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Index ¶
- type XDGDir
- func (x *XDGDir) Dirs() []string
- func (x *XDGDir) Ensure(suffix string) (absPath string, err error)
- func (x *XDGDir) EnsureDir(suffix string) (absPath string, err error)
- func (x *XDGDir) Find(suffix string) (absPath string, err error)
- func (x *XDGDir) FindHome(suffix string) (absPath string, err error)
- func (x *XDGDir) Home() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XDGDir ¶
type XDGDir struct {
// contains filtered or unexported fields
}
An XDGDir holds configuration for and can be used to access the XDG-specified base directories relative to which user-specific files of a given type should be stored.
Typically you wouldn't use XDGDir directly, but one of the predefined ones which implement the spec: Data, Config and Cache.
func (*XDGDir) Dirs ¶
Dirs returns the preference-ordered set of base directories to search for files of the given type, starting with the user-specific one, as specified (or not) by the user's environment.
func (*XDGDir) Ensure ¶
Ensure takes the path suffix given, and ensures that a matching file exists in the home XDG directory. If it doesn't exist it is created. If it can't be created, or exists but is unreadable, an error is returned.
func (*XDGDir) EnsureDir ¶
Ensure takes the path suffix given, and ensures that a matching directory exists in the home XDG directory. If it doesn't exist it is created. If it can't be created, or exists but is unreadable, an error is returned.
func (*XDGDir) Find ¶
Find attempts to find the path suffix in all of the known XDG directories. If not found, an error is returned.