config & constants: Use constants for default locations.

This commit is contained in:
Glenn Y. Rolland 2011-09-04 04:50:38 +02:00
parent ea9ac49fed
commit 77adfe9d6f
2 changed files with 10 additions and 20 deletions

View file

@ -20,27 +20,10 @@ module Qasim
def initialize
user = if ENV['USER'] then
ENV['USER']
else
raise "Environment variable 'USER' is missing!"
end
home_dir = if ENV['HOME'] then
ENV['HOME']
else
"/home/" + user
end
@mnt_dir = File.join ENV['HOME'], "mnt"
xdg_dir = if ENV['XDG_CONFIG_HOME'] then
ENV['XDG_CONFIG_HOME']
else
home_dir + '/.config'
end
@mnt_dir = File.join home_dir, "mnt"
@config_dir = xdg_dir + '/sshfs-mapper'
@config_dir = APP_CONFIG_DIR
@config_file = nil
@maps = []
@initialize_enable = false

View file

@ -1,6 +1,13 @@
module Qasim
APP_ICON_PATH = File.join QASIM_INCLUDE_DIR, "icons"
APP_SYSCONFIG_DIR = "/etc/qasim/maps.d"
APP_NAME = "Qasim"
APP_VERSION = "0.1"
APP_SYSCONFIG_DIR = "/etc/qasim/maps.d"
APP_CONFIG_DIR = if ENV['XDG_CONFIG_HOME'] then
File.join ENV['XDG_CONFIG_HOME'], 'qasim'
else
File.join ENV['HOME'], '.config', 'qasim'
end
end