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:
2023-11-18 15:24:07 -06:00
parent f98edc1744
commit 4bdc12ce46
22 changed files with 113 additions and 99 deletions

View File

@@ -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