Documentation
¶
Overview ¶
Package userdirs answers where a user's config and data folders are for a given home. Each function takes the home folder the caller resolves for (a test's temporary home, another account's profile).
An environment value is used only when home is this process's own home (os.UserHomeDir, compared after filepath.Clean and, on Windows, case-folded) and the value is an absolute path; the XDG Base Directory spec says to ignore a relative one. Otherwise the default under home is returned. home == "" returns "" for every function, since the environment describes only the real home: the caller turns "" into an error. No function reads runtime.GOOS: the caller picks the layout it is resolving.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigHome ¶
ConfigHome is $XDG_CONFIG_HOME, else home/.config.
func FlatpakApp ¶
FlatpakApp is home/.var/app/<appID>, the per-user folder Flatpak gives each app. appID becomes one path element, so a value that is not one ("" , "." , ".." or anything holding a separator) would escape .var/app and returns "".
func HostConfigHome ¶
HostConfigHome and HostDataHome are the host user's folders, for reading another program's files. Outside a Flatpak they equal ConfigHome and DataHome. Inside one (flatpak.Inside) Flatpak points XDG_CONFIG_HOME and XDG_DATA_HOME at the app's own ~/.var/app folder, so those are skipped; HOST_XDG_CONFIG_HOME and HOST_XDG_DATA_HOME, which Flatpak sets to the host's custom folders, are read under the same rule, else the default under home is returned.
func HostDataHome ¶
HostDataHome is HostConfigHome for the data home.
func LocalAppData ¶
LocalAppData is %LOCALAPPDATA%, else home/AppData/Local.
Types ¶
This section is empty.