diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/migration/migrator/prosody_files.lua | 1 | ||||
-rw-r--r-- | tools/migration/prosody-migrator.lua | 24 |
2 files changed, 11 insertions, 14 deletions
diff --git a/tools/migration/migrator/prosody_files.lua b/tools/migration/migrator/prosody_files.lua index be0c49f8..4462fb3e 100644 --- a/tools/migration/migrator/prosody_files.lua +++ b/tools/migration/migrator/prosody_files.lua @@ -7,7 +7,6 @@ local char = string.char; local coroutine = coroutine; local lfs = require "lfs"; local loadfile = loadfile; -local setfenv = setfenv; local pcall = pcall; local mtools = require "migrator.mtools"; local next = next; diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua index 2a8bf1c3..7c933b88 100644 --- a/tools/migration/prosody-migrator.lua +++ b/tools/migration/prosody-migrator.lua @@ -30,16 +30,22 @@ for i = 1, #arg do end table.remove(arg, handled_opts); +if CFG_SOURCEDIR then + package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; + package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath; +else + package.path = "../../?.lua;"..package.path + package.cpath = "../../?.so;"..package.cpath +end + +local envloadfile = require "util.envload".envloadfile; + -- Load config file local function loadfilein(file, env) if loadin then return loadin(env, io.open(file):read("*a")); else - local chunk, err = loadfile(file); - if chunk then - setfenv(chunk, env); - end - return chunk, err; + return envloadfile(file, env); end end @@ -59,14 +65,6 @@ end config_chunk(); -if CFG_SOURCEDIR then - package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; - package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath; -elseif not package.loaded["util.json"] then - package.path = "../../?.lua;"..package.path - package.cpath = "../../?.so;"..package.cpath -end - local have_err; if #arg > 0 and #arg ~= 2 then have_err = true; |