Refactor configuration loading to use dynamic base directory path
This commit is contained in:
@@ -24,14 +24,17 @@ local DROPPER_ANNOUNCE_INTERVAL = 30 -- seconds between dropper announcements
|
|||||||
-- Load config from file if present
|
-- Load config from file if present
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
local CLIENT_CONFIG_FILE = ".client_config"
|
local _baseDir = fs.getDir(shell.getRunningProgram())
|
||||||
|
local function _path(rel) return fs.combine(_baseDir, rel) end
|
||||||
|
|
||||||
|
local CLIENT_CONFIG_FILE = _path(".client_config")
|
||||||
|
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
-- Shared UI helpers (loaded early for config use)
|
-- Shared UI helpers (loaded early for config use)
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
local ui = dofile("lib/ui.lua")
|
local ui = dofile(_path("lib/ui.lua"))
|
||||||
local log = dofile("lib/log.lua")
|
local log = dofile(_path("lib/log.lua"))
|
||||||
|
|
||||||
local function loadConfig()
|
local function loadConfig()
|
||||||
if not fs.exists(CLIENT_CONFIG_FILE) then return end
|
if not fs.exists(CLIENT_CONFIG_FILE) then return end
|
||||||
|
|||||||
Reference in New Issue
Block a user