From 18bdac03b19f68a39584dd96f444ea4af11608b9 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 22 Mar 2026 20:55:33 -0400 Subject: [PATCH] Fix config.lua crash: move _configPath before first use _configPath was called at lines 26/28 (CACHE_FILE, DISABLED_RECIPES_FILE) but only defined at line 79. Moved the definition to the top of the function body so it exists before the first call. --- manager/config.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/manager/config.lua b/manager/config.lua index 709cf08..7ac44b4 100644 --- a/manager/config.lua +++ b/manager/config.lua @@ -6,6 +6,16 @@ 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 +-- Persistent config path: survives Opus package updates +local _PERSIST_DIR = "usr/config/inventory-manager" +local function _configPath(rel) + if fs.isDir(_PERSIST_DIR) or fs.isDir("packages/inventory-manager") then + if not fs.isDir(_PERSIST_DIR) then fs.makeDir(_PERSIST_DIR) end + return fs.combine(_PERSIST_DIR, rel) + end + return _path(rel) +end + local C = {} ------------------------------------------------- @@ -71,16 +81,6 @@ C.SLOT_OUTPUT = 3 -- Config file loader ------------------------------------------------- --- Persistent config path: survives Opus package updates -local _PERSIST_DIR = "usr/config/inventory-manager" -local function _configPath(rel) - if fs.isDir(_PERSIST_DIR) or fs.isDir("packages/inventory-manager") then - if not fs.isDir(_PERSIST_DIR) then fs.makeDir(_PERSIST_DIR) end - return fs.combine(_PERSIST_DIR, rel) - end - return _path(rel) -end - local CONFIG_FILE = _configPath(".manager_config") function C.loadConfig()