_auRequireTable = {} function auRequireAbs(path, invalidate) -- this is stupid return auRequire(_G.path.getrelative(Aurora.Settings.sAbsScripts, path), nil, invalidate) end function auRequire(relPath, subdir, invalidate) -- this is stupid local buildScripts = auGetAuroraRoot() local premakeRequireRootCWD = Aurora.Settings.sAbsScripts if (not subdir) then buildScripts = premakeRequireRootCWD else buildScripts = buildScripts .. subdir end buildScripts = os.realpath(buildScripts) .. "/" if (os.isdir(buildScripts .. relPath)) then relPath = relPath .. (relPath:match("/[^/]*$") or ("/".. relPath)) .. ".lua" end if (not relPath:ends(".lua")) then relPath = "/" .. relPath .. ".lua" end relPath = _G.path.translate(relPath) if (not os.isfile(buildScripts .. relPath)) then auFatal("Script not found: ", relPath) end local realPath = os.realpath(buildScripts .. relPath) -- premake should support modules.loaded[modname] (iirc), but either way, i'm being extra safe -- we once used rel paths with require so this was required -- invalidation requests don't seem to make much sense, but they can stay in a hint -- wont remove this for.now local cache = _auRequireTable[realPath] if (cache and not invalidate) then return cache end local result = require(realPath:sub(1, #realPath - 4)) _auRequireTable[realPath] = result return result end