Module: Ronin::Core::Home

Defined in:
lib/ronin/core/home.rb

Overview

Home directory constants and methods.

Constant Summary collapse

DIR =

Path to the user's home directory.

Gem.user_home
CACHE_DIR =

Path to the user's ~/.cache/ directory.

ENV.fetch('XDG_CACHE_HOME') do
  File.join(DIR,'.cache')
end
CONFIG_DIR =

Path to the user's ~/.config/ directory.

ENV.fetch('XDG_CONFIG_HOME') do
  File.join(DIR,'.config')
end
LOCAL_SHARE_DIR =

Path to the user's ~/.local/share directory.

ENV.fetch('XDG_DATA_HOME') do
  File.join(DIR,'.local','share')
end

Class Method Summary collapse

Class Method Details

.cache_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.cache/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.cache/<subdir> directory.



44
45
46
# File 'lib/ronin/core/home.rb', line 44

def self.cache_dir(subdir)
  File.join(CACHE_DIR,subdir)
end

.config_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.config/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.config/<subdir> directory.



62
63
64
# File 'lib/ronin/core/home.rb', line 62

def self.config_dir(subdir)
  File.join(CONFIG_DIR,subdir)
end

.local_share_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.local/share/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.local/share/<subdir> directory.



81
82
83
# File 'lib/ronin/core/home.rb', line 81

def self.local_share_dir(subdir)
  File.join(LOCAL_SHARE_DIR,subdir)
end