diff options
-rw-r--r-- | server/main.lua | 5 | ||||
-rw-r--r-- | server/publish.lua | 7 | ||||
-rw-r--r-- | server/test.lua | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/server/main.lua b/server/main.lua index bb40f86d..597c40bb 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,12 +1,15 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2) local rootPath = currentPath:gsub('[^/\\]-$', '') +if rootPath == '' then + rootPath = './' +end package.cpath = rootPath .. 'bin/?.so' .. ';' .. rootPath .. 'bin/?.dll' package.path = rootPath .. 'src/?.lua' .. ';' .. rootPath .. 'src/?/init.lua' local fs = require 'bee.filesystem' -ROOT = fs.path(rootPath:gsub('[/\\]$', '')) +ROOT = fs.path(rootPath) LANG = LANG or 'en-US' --collectgarbage('generational') diff --git a/server/publish.lua b/server/publish.lua index 768b9766..1577b6ee 100644 --- a/server/publish.lua +++ b/server/publish.lua @@ -1,5 +1,8 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2) local rootPath = currentPath:gsub('[^/\\]-$', '') +if rootPath == '' then + rootPath = './' +end package.cpath = rootPath .. 'bin/?.so' .. ';' .. rootPath .. 'bin/?.dll' package.path = rootPath .. 'src/?.lua' @@ -7,8 +10,8 @@ package.path = rootPath .. 'src/?.lua' local fs = require 'bee.filesystem' local subprocess = require 'bee.subprocess' -ROOT = fs.path(rootPath:gsub('[/\\]$', '')) -EXTENSION = ROOT:parent_path() +ROOT = fs.path(rootPath) +EXTENSION = fs.path(rootPath .. '..') require 'utility' local json = require 'json' diff --git a/server/test.lua b/server/test.lua index 7dc1c0ae..c1d128f1 100644 --- a/server/test.lua +++ b/server/test.lua @@ -1,5 +1,8 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2) local rootPath = currentPath:gsub('[^/\\]-$', '') +if rootPath == '' then + rootPath = './' +end package.cpath = rootPath .. 'bin/?.so' .. ';' .. rootPath .. 'bin/?.dll' package.path = rootPath .. 'src/?.lua' @@ -7,7 +10,7 @@ package.path = rootPath .. 'src/?.lua' local fs = require 'bee.filesystem' local subprocess = require 'bee.subprocess' -ROOT = fs.path(rootPath:gsub('[/\\]$', '')) +ROOT = fs.path(rootPath) local function runTest(root) local is_macos = package.cpath:sub(-3) == '.so' |