getXdgBaseDirectories
getXdgBaseDirectories(
options?):XdgBaseDirectories
Defined in: packages/app-system/src/os/xdg-base-directories.ts:69
Resolves the XDG base directories (specification 0.8): where an application should read and write its data, configuration, state, cache and runtime files on Linux and other freedesktop.org systems.
Append the application’s own directory name to the one it needs:
join(getXdgBaseDirectories().dataHome, "myapp"). Nothing is created.
A variable that is unset, empty or holds a relative path falls back to its default, as the specification requires; in a list, relative entries are dropped, and a list left empty falls back too.
Time complexity: O(n) in the length of the variables read. Memory: O(n).
Parameters
Section titled “Parameters”options?
Section titled “options?”The environment and home directory to read.
Returns
Section titled “Returns”The directories, as absolute paths.
Example
Section titled “Example”getXdgBaseDirectories({ env: {}, home: "/home/ada" }).dataHome; // "/home/ada/.local/share"