Sha256: 78f45b73cf45e51a7144e2d3268198cfe8d75e56d8393018ec63c00cd6bd167f

Contents?: true

Size: 773 Bytes

Versions: 5

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

require "pathname"

module Runcom
  module XDG
    # Represents X Desktop Group (XGD) configuration support. XGD is also known as
    # [Free Desktop](https://www.freedesktop.org). Here is the exact
    # [specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html) being
    # for this implementation.
    class Configuration
      def self.home_dir
        ENV.fetch "XDG_CONFIG_HOME", File.join(ENV["HOME"], ".config")
      end

      def self.dirs
        ENV.fetch("XDG_CONFIG_DIRS", "/etc/xdg").split ":"
      end

      def self.computed_dirs
        directories = dirs.unshift(home_dir).map { |directory| Pathname(directory).expand_path }
        directories.select(&:exist?)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
runcom-1.4.1 lib/runcom/xdg/configuration.rb
runcom-1.4.0 lib/runcom/xdg/configuration.rb
runcom-1.3.0 lib/runcom/xdg/configuration.rb
runcom-1.2.0 lib/runcom/xdg/configuration.rb
runcom-1.1.0 lib/runcom/xdg/configuration.rb