GLXCurses.libs.XDGBaseDirectory module¶
-
GLXCurses.libs.XDGBaseDirectory.
control_directory
(directory=None, mode=448)[source]¶ Internal function it create a directory if not exist
Parameters: - directory –
- mode (int) – the permission mode of the directory if created example:
0o700
Type: str
Returns: the directory path or None
Return type: str
Raises: - TypeError – when
directory
is not a str type - TypeError – when
directory
is not a int type
-
class
GLXCurses.libs.XDGBaseDirectory.
XDGBaseDirectory
[source]¶ Bases:
object
-
xdg_data_home
¶ $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored.
If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.
Returns: base directory relative to which user specific data files Return type: str
-
xdg_config_home
¶ $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored.
If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
Returns: base directory relative to which user specific configuration files Return type: str
-
xdg_data_dirs
¶ $XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory.
The directories in $XDG_DATA_DIRS should be separated with a colon ‘:’.
If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.
Returns: preference-ordered set of base directories to search for data files separated with a colon ‘:’ Return type: str
-
xdg_config_dirs
¶ $XDG_CONFIG_DIRS defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory.
The directories in $XDG_CONFIG_DIRS should be separated with a colon ‘:’.
If $XDG_CONFIG_DIRS is either not set or empty, a value equal to /etc/xdg should be used.
Returns: preference-ordered set of base directories to search for configuration files separated with a colon ‘:’ Return type: str
-
xdg_cache_home
¶ $XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored.
If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.
Returns: base directory relative to which user specific non-essential data files Return type: str
-
xdg_runtime_dir
¶ $XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, …) should be stored.
If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message.
Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.
Returns: base directory relative to which user-specific non-essential runtime files Return type: str
-
resource
¶ resource
should normally be the name of your application or a shared resource.Returns: name of your application or a shared resource Return type: str
-
set_resource
(*resource)[source]¶ Set the
resource
property value.Parameters: resource (tuple like 'Hello', '42') – should normally be the name of your application Raises: AssertionError – If when join the tuple start by os.path.sep typically /
-
config_path
¶ Ensure
$XDG_CONFIG_HOME/<resource>/
exists, and return its path.Returns: $XDG_CONFIG_HOME/<resource>/
pathReturn type: str
-
config_paths
¶ 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.
Returns: pre-ordered set of base directories to search for configuration files directory for resource
Return type: list
-
data_path
¶ Ensure
$XDG_DATA_HOME/<resource>/
exists, and return its path.Returns: $XDG_DATA_HOME/<resource>/
pathReturn type: str
-
data_paths
¶ 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.
Returns: preference-ordered set of base directories to search for data files directory for resource
Return type: list
-
cache_path
¶ Ensure
$XDG_CACHE_HOME/<resource>/
exists, and return its path.Returns: $XDG_CACHE_HOME/<resource>/
pathReturn type: str
-