From 4ebec8b01a9d0634e55d371c2547bfe24abedfd4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 29 May 2017 17:53:54 +1000 Subject: src/defs.js: Add default paths for WEB --- src/defs.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/defs.js b/src/defs.js index ba1bd28..3d355de 100644 --- a/src/defs.js +++ b/src/defs.js @@ -278,7 +278,26 @@ module.exports.LUA_EXEC_DIR = LUA_EXEC_DIR; const LUA_VDIR = LUA_VERSION_MAJOR + "." + LUA_VERSION_MINOR; module.exports.LUA_VDIR = LUA_VDIR; -if (!WEB && (require('os')).platform() === 'win32') { +if (WEB) { + const LUA_DIRSEP = "/"; + module.exports.LUA_DIRSEP = LUA_DIRSEP; + + const LUA_LDIR = "./lua/" + LUA_VDIR + "/"; + module.exports.LUA_LDIR = LUA_LDIR; + + const LUA_CDIR = "./lua/" + LUA_VDIR + "/"; + module.exports.LUA_CDIR = LUA_CDIR; + + const LUA_PATH_DEFAULT = + LUA_LDIR + "?.lua;" + LUA_LDIR + "?/init.lua;" + + LUA_CDIR + "?.lua;" + LUA_CDIR + "?/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"; + module.exports.LUA_CPATH_DEFAULT = LUA_CPATH_DEFAULT; +} else if (require('os').platform() === 'win32') { const LUA_DIRSEP = "\\"; module.exports.LUA_DIRSEP = LUA_DIRSEP; @@ -313,19 +332,19 @@ if (!WEB && (require('os')).platform() === 'win32') { const LUA_ROOT = "/usr/local/"; module.exports.LUA_ROOT = LUA_ROOT; - + const LUA_LDIR = LUA_ROOT + "share/lua/" + LUA_VDIR + "/"; module.exports.LUA_LDIR = LUA_LDIR; - + const LUA_CDIR = LUA_ROOT + "lib/lua/" + LUA_VDIR + "/"; module.exports.LUA_CDIR = LUA_CDIR; - + const LUA_PATH_DEFAULT = LUA_LDIR + "?.lua;" + LUA_LDIR + "?/init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?/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"; module.exports.LUA_CPATH_DEFAULT = LUA_CPATH_DEFAULT; -- cgit v1.2.3-70-g09d2