mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 21:32:35 +00:00
Refactored ROOT_PATH to be a subfolder in the current user's home directory (configs and settings will not need to be manually moved between updates)
This commit is contained in:
@@ -2,6 +2,8 @@ module TAC
|
||||
class Backend
|
||||
attr_reader :config, :settings, :tacnet
|
||||
def initialize
|
||||
create_directories
|
||||
|
||||
load_settings
|
||||
load_config(@settings.config) if @settings.config && File.exist?("#{TAC::CONFIGS_PATH}/#{@settings.config}.json")
|
||||
@tacnet = TACNET.new
|
||||
@@ -113,6 +115,12 @@ module TAC
|
||||
@settings_changed
|
||||
end
|
||||
|
||||
def create_directories
|
||||
FileUtils.mkdir_p(TAC::ROOT_PATH) unless File.exist?(TAC::ROOT_PATH)
|
||||
FileUtils.mkdir_p(TAC::CONFIGS_PATH) unless File.exist?(TAC::CONFIGS_PATH)
|
||||
# FileUtils.mkdir_p(TAC::SETTINGS_PATH) unless File.exist?(TAC::SETTINGS_PATH)
|
||||
end
|
||||
|
||||
def load_settings
|
||||
if File.exist?(TAC::SETTINGS_PATH)
|
||||
@settings = TAC::Settings.new
|
||||
|
||||
Reference in New Issue
Block a user