Class | XDG::BaseDir |
In: |
lib/xdg/base_dir.rb
lib/xdg/base_dir/legacy.rb lib/xdg/base_dir/extended.rb lib/xdg/base_dir/mixin.rb |
Parent: | Object |
Base directory interface class.
DEFAULTS | = | { 'XDG_DATA_HOME' => ['~/.local/share'], 'XDG_DATA_DIRS' => ['/usr/local/share', datadir], 'XDG_CONFIG_HOME' => ['~/.config'], 'XDG_CONFIG_DIRS' => [File.join(sysconfdir,'xdg'), sysconfdir], 'XDG_CACHE_HOME' => ['~/.cache'], 'XDG_CACHE_DIRS' => ['/tmp'] | Standard defaults for locations. |
subdirectory | [R] | The common subdirectory. |
The environment setting, or it‘s equivalent when the BaseDir is a combination of environment variables.
@return [String] evnironment vsetting
The environment variables being referenced.
@return [Array] list of XDG environment variable names
This is same as environment, but also includes default values.
@return [String] envinronment value.
Find a file or directory. This works just like select except that it returns the first match found.
TODO: It would be more efficient to traverse the dirs and use fnmatch.
Return array of matching files or directories in any of the resource locations, starting with the home directory and searching outward into system directories.
Unlike select, this doesn‘t take a block and each additional glob argument is treated as a logical-or.
XDG[:DATA].glob("stick/*.rb", "stick/*.yaml")
List of directories as Pathanme objects.
@return [Array<Pathname>] list of directories as Pathname objects
Return array of matching files or directories in any of the resource locations, starting with the home directory and searching outward into system directories.
String parameters are joined into a pathname while Integers and Symbols treated as flags.
For example, the following are equivalent:
XDG::BaseDir[:DATA,:HOME].select('stick/units', File::FNM_CASEFOLD) XDG::BaseDir[:DATA,:HOME].select('stick', 'units', :casefold)
Returns the first directory expanded. Since a environment settings like `*_HOME` will only have one directory entry, this definition of to_s makes utilizing those more convenient.
@return [String] directory