module watt.xdg.basedir

Retrieve paths to XDG standard directories.

The XDG Specification specifies where files should be located on a system. This module retrieves those paths.

Code Map

//! Retrieve paths to XDG standard directories.
module watt.xdg.basedir;


//! Get the config dirs values.
fn getConfigDirs() string[] { }
//! Get the configuration home value.
fn getConfigHome() string { }
//! Get the data dirs values.
fn getDataDirs() string[] { }
//! Get the data home value.
fn getDataHome() string { }
//! Find a configuration file.
fn findConfigFile(tail: string) string[] { }
fn getConfigDirs() string[]

Get the config dirs values.

The config dirs are a "preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory.

If $XDG_CONFIG_DIRS is set, it is returned.
Otherwise, the XDG default is returned.

fn getConfigHome() string

Get the configuration home value.

The config home is a "base directory relative to which user specific configuration files should be stored".

If $XDG_CONFIG_HOME is set, it is returned.
Otherwise, the XDG default is returned. If the environment does not have $HOME set, or it is invalid, an empty string is returned.

fn getDataDirs() string[]

Get the data dirs values.

The data dirs are a "preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory"

If $XDG_DATA_DIRS is set, it is returned.
Otherwise, the XDG default is returned.

fn getDataHome() string

Get the data home value.

The data home is a "base directory relative to which user specific data files should be stored".

If $XDG_DATA_HOME is set, it is returned. Otherwise, the XDG default is returned.

fn findConfigFile(tail: string) string[]

Find a configuration file.

Uses the paths returned by getConfigHome and getConfigDirs to find all matching files. The personal files (from getConfigHome will be first, followed by the config dirs.

Return

A list of full paths to files that match.