fix: resolve all paths relative to script directory for Opus package compatibility

- Add _baseDir/_path() resolution using shell.getRunningProgram() in all
  entry-point scripts (inventoryManager, inventoryClient, craftingTurtle,
  inventoryWebBridge)
- Pass _path function through to manager/config.lua for data/ and config files
- Config files (.manager_config, .inventory_cache, etc.) now resolve relative
  to the package directory rather than CWD
- Exclude startup/ auto-updater scripts from Opus .package manifest
- All dofile() calls now use _path() for portable path resolution
This commit is contained in:
MayaTheShy
2026-03-22 16:07:43 -04:00
parent 4d8229ab46
commit 57fd3e88bc

View File

@@ -1,7 +1,10 @@
-- manager/config.lua — Configuration constants, data tables, and lookup structures
-- Usage: local cfg = dofile("manager/config.lua")(log)
-- Usage: local cfg = dofile(_path("manager/config.lua"))(log, _path)
return function(log)
return function(log, _path)
-- Fall back to CWD-relative if _path not provided (standalone use)
if not _path then _path = function(p) return p end end
local C = {}
@@ -19,9 +22,9 @@ C.SMELT_RESERVE = 128
C.DEFRAG_INTERVAL = 600
C.COMPOST_INTERVAL = 3
C.ALERT_INTERVAL = 15
C.CACHE_FILE = ".inventory_cache"
C.CACHE_FILE = _path(".inventory_cache")
C.SMELTER_MONITOR_SIDE = "top"
C.DISABLED_RECIPES_FILE = ".disabled_recipes"
C.DISABLED_RECIPES_FILE = _path(".disabled_recipes")
-- Network
C.BROADCAST_CHANNEL = 4200
@@ -57,7 +60,7 @@ C.SLOT_OUTPUT = 3
-- Config file loader
-------------------------------------------------
local CONFIG_FILE = ".manager_config"
local CONFIG_FILE = _path(".manager_config")
function C.loadConfig()
if not fs.exists(CONFIG_FILE) then return end
@@ -97,13 +100,13 @@ end
-- Data tables
-------------------------------------------------
C.SMELTABLE = dofile("data/smeltable.lua")
C.FUEL_LIST = dofile("data/fuel.lua")
local _compostData = dofile("data/compostable.lua")
C.SMELTABLE = dofile(_path("data/smeltable.lua"))
C.FUEL_LIST = dofile(_path("data/fuel.lua"))
local _compostData = dofile(_path("data/compostable.lua"))
C.COMPOSTABLE = _compostData.items
C.COMPOST_TRASH = _compostData.trash
C.CRAFTABLE = dofile("data/craftable.lua")
C.LOW_STOCK_ALERTS = dofile("data/alerts.lua")
C.CRAFTABLE = dofile(_path("data/craftable.lua"))
C.LOW_STOCK_ALERTS = dofile(_path("data/alerts.lua"))
-- Pre-build furnace compatibility sets for O(1) lookup
for _, recipe in pairs(C.SMELTABLE) do