diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defs.js | 30 | ||||
-rw-r--r-- | src/loadlib.js | 4 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/defs.js b/src/defs.js index 9eeea00..70d0c73 100644 --- a/src/defs.js +++ b/src/defs.js @@ -358,14 +358,16 @@ if (typeof process === "undefined") { const LUA_CDIR = "./lua/" + LUA_VDIR + "/"; module.exports.LUA_CDIR = LUA_CDIR; - const LUA_PATH_DEFAULT = + const LUA_PATH_DEFAULT = to_luastring( LUA_LDIR + "?.lua;" + LUA_LDIR + "?/init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?/init.lua;" + - "./?.lua;./?/init.lua"; + "./?.lua;./?/init.lua" + ); module.exports.LUA_PATH_DEFAULT = LUA_PATH_DEFAULT; - const LUA_CPATH_DEFAULT = - LUA_CDIR + "?.js;" + LUA_CDIR + "loadall.js;./?.js"; + const LUA_CPATH_DEFAULT = to_luastring( + LUA_CDIR + "?.js;" + LUA_CDIR + "loadall.js;./?.js" + ); module.exports.LUA_CPATH_DEFAULT = LUA_CPATH_DEFAULT; } else if (require('os').platform() === 'win32') { const LUA_DIRSEP = "\\"; @@ -384,17 +386,19 @@ if (typeof process === "undefined") { const LUA_SHRDIR = "!\\..\\share\\lua\\" + LUA_VDIR + "\\"; module.exports.LUA_SHRDIR = LUA_SHRDIR; - const LUA_PATH_DEFAULT = + const LUA_PATH_DEFAULT = to_luastring( LUA_LDIR + "?.lua;" + LUA_LDIR + "?\\init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?\\init.lua;" + LUA_SHRDIR + "?.lua;" + LUA_SHRDIR + "?\\init.lua;" + - ".\\?.lua;.\\?\\init.lua"; + ".\\?.lua;.\\?\\init.lua" + ); module.exports.LUA_PATH_DEFAULT = LUA_PATH_DEFAULT; - const LUA_CPATH_DEFAULT = + const LUA_CPATH_DEFAULT = to_luastring( LUA_CDIR + "?.dll;" + LUA_CDIR + "..\\lib\\lua\\" + LUA_VDIR + "\\?.dll;" + - LUA_CDIR + "loadall.dll;.\\?.dll"; + LUA_CDIR + "loadall.dll;.\\?.dll" + ); module.exports.LUA_CPATH_DEFAULT = LUA_CPATH_DEFAULT; } else { const LUA_DIRSEP = "/"; @@ -409,14 +413,16 @@ if (typeof process === "undefined") { const LUA_CDIR = LUA_ROOT + "lib/lua/" + LUA_VDIR + "/"; module.exports.LUA_CDIR = LUA_CDIR; - const LUA_PATH_DEFAULT = + const LUA_PATH_DEFAULT = to_luastring( LUA_LDIR + "?.lua;" + LUA_LDIR + "?/init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?/init.lua;" + - "./?.lua;./?/init.lua"; + "./?.lua;./?/init.lua" + ); module.exports.LUA_PATH_DEFAULT = LUA_PATH_DEFAULT; - const LUA_CPATH_DEFAULT = - LUA_CDIR + "?.so;" + LUA_CDIR + "loadall.so;./?.so"; + const LUA_CPATH_DEFAULT = to_luastring( + LUA_CDIR + "?.so;" + LUA_CDIR + "loadall.so;./?.so" + ); module.exports.LUA_CPATH_DEFAULT = LUA_CPATH_DEFAULT; } diff --git a/src/loadlib.js b/src/loadlib.js index 3fcc7c5..83335da 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -288,7 +288,7 @@ const setpath = function(L, fieldname, envname, dft) { if (path === undefined) /* no environment variable? */ path = env[envname]; /* try unversioned name */ if (path === undefined || noenv(L)) /* no environment variable? */ - lua_pushstring(L, to_luastring(dft)); /* use default */ + lua_pushstring(L, dft); /* use default */ else { /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ path = luaL_gsub( @@ -297,7 +297,7 @@ const setpath = function(L, fieldname, envname, dft) { to_luastring(LUA_PATH_SEP + LUA_PATH_SEP, true), to_luastring(LUA_PATH_SEP + to_jsstring(AUXMARK) + LUA_PATH_SEP, true) ); - luaL_gsub(L, path, AUXMARK, to_luastring(dft)); + luaL_gsub(L, path, AUXMARK, dft); lua_remove(L, -2); /* remove result from 1st 'gsub' */ } lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */ |