Table of Contents

Class BaseDirectory

Namespace
Xdg.Directories
Assembly
Xdg.Directories.dll

The XDG Base Directory specification is a standard created by freedesktop.org that standardizes the location of storing application files.

public static class BaseDirectory
Inheritance
BaseDirectory
Inherited Members

Remarks


This allows users to have less clutter in their home directories, and allows programmers to not have to hard-code directories.


For all base directories, the directories are resolved as follows:
  1. The respective XDG_* enivronment variable will always be used if specified
  2. Windows Use Known Folders.
    macOS Follow the Apple documentation on application-specific files.
    Linux/FreeBSD Follow the XDG Base Directory specification.

Properties

BinHome

Base directory for executable files.

public static string BinHome { get; }

Property Value

string

A single base directory relative to which user-specifc executable files should be written.

Remarks

If XDG_BIN_HOME is set, the directory specified.

Windows""
Windows does not support this by default.
macOS""
macOS does not support this by default.
Linux/FreeBSD$HOME/.local/bin
NOTE: This is not an XDG standard but a de facto standard.

CacheHome

Base directory for non-essential data.

public static string CacheHome { get; }

Property Value

string

A single base directory relative to which user-specifc non-essential data should be written.

Remarks

If XDG_CACHE_HOME is set, the directory specified.

Windows%LOCALAPPDATA%\cache
macOS$HOME/Library/Caches
Linux/FreeBSD$HOME/.cache

ConfigDirs

A list of directories to look for configuration files.

public static IList<string> ConfigDirs { get; }

Property Value

IList<string>

A set of preference-ordered base directories to which configuration files should be searched.

Remarks

If XDG_CONFIG_DIRS is set, a list of the directories specified.

Windows%ProgramData%, %APPADATA%
macOS~/Library/Preferences, /Library/Application Support, /Library/Preferences
Linux/FreeBSD/etc/xdg
This is typically not used, for most use cases ConfigHome should be used instead.

ConfigHome

Base directory for configuration files.

public static string ConfigHome { get; }

Property Value

string

A single base directory relative to which user-specifc configuration files should be written.

Remarks

If XDG_CONFIG_HOME is set, the directory specified.

Windows%LOCALAPPDATA%
macOS$HOME/Library/Application Support
Linux/FreeBSD$HOME/.config

DataDirs

A list of directories to search for data files.

public static IList<string> DataDirs { get; }

Property Value

IList<string>

A set of preference-ordered base directories to which data files should be searched.

Remarks

If XDG_DATA_DIRS is set, a list of the directories specified.

Windows%APPADATA%, %ProgramData%
macOS/Library/Application Support
Linux/FreeBSD/usr/local/share/, /usr/share/

DataHome

Base directory for data files.

public static string DataHome { get; }

Property Value

string

A single base directory relative to which user-specifc data files should be written.

Remarks

If XDG_DATA_HOME is set, the directory specified.

Windows%LOCALAPPDATA%
macOS$HOME/Library/Application Support
Linux/FreeBSD$HOME/.local/share

RuntimeDir

Base directory for runtime-specific files.

public static string RuntimeDir { get; }

Property Value

string

A single base directory relative to which user-specifc runtime files should be written.

Remarks

If XDG_RUNTIME_DIR is set, the directory specified.

Windows%LOCALAPPDATA%
macOS$HOME/Library/Application Support
Linux/FreeBSD/run/user/$UID

StateHome

Base directory for state data.

public static string StateHome { get; }

Property Value

string

A single base directory relative to which user-specifc state data should be written.

Remarks

If XDG_STATE_HOME is set, the directory specified.

Windows%LOCALAPPDATA%
macOS$HOME/Library/Application Support
Linux/FreeBSD$HOME/.local/state