module Caligari::XDG

This module contains constants representing XDG configuration directories and files for Caligari as specified by the XDG Base Directory Specification.

@see polr.me/zjp XDG Base Directory Specification

Constants

CONFIG_DIRS

The global XDG configuration directories as an array of `Pathname` instances.

CONFIG_FILES

The existent XDG configuration files for Caligari as a `Pathname` instance.

CONFIG_HOME

The user XDG configuration directory as a `Pathname` instance.

Private Class Methods

collect_xdg_config_dirs() click to toggle source

Collects configuration directories as defined by the XDG Base Directory Specification as `Pathname` instances.

@api private @return [Array<Pathname>] the collected XDG configuration directories

# File lib/caligari/xdg.rb, line 15
def self.collect_xdg_config_dirs
  dirs = ENV['XDG_CONFIG_DIRS']
  if dirs
    dirs.split(':').map! do |dir|
      Pathname.new(dir).expand_path.freeze
    end.freeze
  else
    [Pathname.new('/etc/xdg').freeze].freeze
  end
end