Base Directories

The XDG Base Directory Speicification provides standard locations to store application data, configuration, and cached data.

Data directories

XDGSpec.BaseDirectory.save_data_pathFunction
save_data_path(resource...)

Ensure $XDG_DATA_HOME/<resource>/ exists, and return its path. 'resource' should normally be the name of your application or a shared resource. Use this when saving or updating application data.

source
XDGSpec.BaseDirectory.load_data_pathsFunction
load_data_paths(resource...)

Returns an iterator which gives each directory named 'resource' in the application data search path. Information provided by earlier directories should take precedence over later ones.

source

Configuration directories

XDGSpec.BaseDirectory.save_config_pathFunction
save_config_path(resource...)

Ensure $XDG_CONFIG_HOME/<resource>/ exists, and return its path. 'resource' should normally be the name of your application. Use this when saving configuration settings.

source
XDGSpec.BaseDirectory.load_config_pathsFunction
load_config_paths(resource...)

Returns an iterator which gives each directory named 'resource' in the configuration search path. Information provided by earlier directories should take precedence over later ones, and the user-specific config dir comes first.

source

Cache directory

XDGSpec.BaseDirectory.save_cache_pathFunction
save_cache_path(resource...)

Ensure $XDG_CACHE_HOME/<resource>/ exists, and return its path. 'resource' should normally be the name of your application or a shared resource.

source

Runtime directory

XDGSpec.BaseDirectory.get_runtime_dirFunction
get_runtime_dir()

Returns the value of $XDG_RUNTIME_DIR, a directory path.

This directory is intended for 'user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...)', and 'communication and synchronization purposes'.

source