class XdgBaseDirectory::XdgDirs
- XdgBaseDirectory::XdgDirs
- Reference
- Object
Overview
XdgDirs is a helper class to quickly access all the xdg-directories for a certain application.
Usage:
xdg_dirs = XdgDirs.new("my-awesome-app")
settings = xdg_dirs.config.read_file("settings.ini")
# ...
Defined in:
xdg_base_directory/xdg_dirs.crConstructors
-
.new(*subdirs : String)
This class assumes that all files live in subdirectories of the XDG base dirs.
Instance Method Summary
-
#all_config_dirs
xdg_config_home + xdg_config_dirs as
XdgDir
s -
#all_data_dirs
xdg_data_home + xdg_data_dirs as
XdgDir
s -
#cache
A directory to which user-specific non-essential (cached) data should be written.
-
#config
A directory to which user-specific configuration files should be written.
-
#config_files(filename)
Look up configuration files by filename in all config dirs in order of importance.
-
#data
A directory to which user-specific data files should be written.
-
#data_files(filename)
Look up data files by filename in all data dirs in order of importance.
-
#runtime_dir
A directory in which user-specific runtime files and other file objects should be placed.
-
#state
state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in data_home
Macro Summary
-
def_xdg_dir(name, method_name = "")
define a method to return the specified
XdgDir
for this application.
Constructor Detail
This class assumes that all files live in subdirectories of the XDG base dirs.
Instance Method Detail
xdg_config_home + xdg_config_dirs as XdgDir
s
The order of base directories denotes their importance; the first directory listed is the most important. When the same information is defined in multiple places the information defined relative to the more important base directory takes precedent. The base directory defined by $XDG_DATA_HOME is considered more important than any of the base directories defined by $XDG_DATA_DIRS. The base directory defined by $XDG_CONFIG_HOME is considered more important than any of the base directories defined by $XDG_CONFIG_DIRS.
xdg_data_home + xdg_data_dirs as XdgDir
s
The order of base directories denotes their importance; the first directory listed is the most important. When the same information is defined in multiple places the information defined relative to the more important base directory takes precedent. The base directory defined by $XDG_DATA_HOME is considered more important than any of the base directories defined by $XDG_DATA_DIRS. The base directory defined by $XDG_CONFIG_HOME is considered more important than any of the base directories defined by $XDG_CONFIG_DIRS.
Look up configuration files by filename in all config dirs in order of importance.
A specification that refers to $XDG_DATA_DIRS or $XDG_CONFIG_DIRS should define what the behaviour must be when a file is located under multiple base directories. It could, for example, define that only the file under the most important base directory should be used or, as another example, it could define rules for merging the information from the different files.
Look up data files by filename in all data dirs in order of importance.
A specification that refers to $XDG_DATA_DIRS or $XDG_CONFIG_DIRS should define what the behaviour must be when a file is located under multiple base directories. It could, for example, define that only the file under the most important base directory should be used or, as another example, it could define rules for merging the information from the different files.
A directory in which user-specific runtime files and other file objects should be placed.
state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in data_home