Package zeroinstall :: Package support :: Module basedir
[frames] | no frames]

Module basedir

source code

Support code for the freedesktop.org basedir spec.

This module provides functions for locating configuration files.


See Also: http://freedesktop.org/wiki/Standards/basedir-spec

Functions
 
save_config_path(*resource)
Ensure $XDG_CONFIG_HOME/<resource>/ exists, and return its path.
source code
 
load_config_paths(*resource)
Returns an iterator which gives each directory named 'resource' in the configuration search path.
source code
 
load_first_config(*resource)
Returns the first result from load_config_paths, or None if there is nothing to load.
source code
 
save_cache_path(*resource)
Ensure $XDG_CACHE_HOME/<resource>/ exists, and return its path.
source code
 
load_cache_paths(*resource)
Returns an iterator which gives each directory named 'resource' in the cache search path.
source code
 
load_first_cache(*resource)
Returns the first result from load_cache_paths, or None if there is nothing to load.
source code
 
load_data_paths(*resource)
Returns an iterator which gives each directory named 'resource' in the shared data search path.
source code
 
load_first_data(*resource)
Returns the first result from load_data_paths, or None if there is nothing to load.
source code
Variables
  xdg_data_home = os.environ.get('XDG_DATA_HOME', os.path.join(_...
  xdg_cache_home = os.environ.get('XDG_CACHE_HOME', os.path.join...
  xdg_config_home = os.environ.get('XDG_CONFIG_HOME', os.path.jo...
  xdg_data_dirs = filter(lambda x: x, xdg_data_dirs)
  xdg_cache_dirs = filter(lambda x: x, xdg_cache_dirs)
  xdg_config_dirs = filter(lambda x: x, xdg_config_dirs)
Function Details

save_config_path(*resource)

source code 

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. Use the xdg_config_dirs variable for loading.

load_config_paths(*resource)

source code 

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 (ie, the user's config dir comes first).

save_cache_path(*resource)

source code 

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

load_cache_paths(*resource)

source code 

Returns an iterator which gives each directory named 'resource' in the cache search path. Information provided by earlier directories should take precedence over later ones (ie, the user's cache dir comes first).

load_data_paths(*resource)

source code 

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

Since: 0.28

load_first_data(*resource)

source code 

Returns the first result from load_data_paths, or None if there is nothing to load.

Since: 0.28


Variables Details

xdg_data_home

Value:
os.environ.get('XDG_DATA_HOME', os.path.join(_home, '.local', 'share')\
)

xdg_cache_home

Value:
os.environ.get('XDG_CACHE_HOME', os.path.join(_home, '.cache'))

xdg_config_home

Value:
os.environ.get('XDG_CONFIG_HOME', os.path.join(_home, '.config'))