summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/publish.lua12
-rw-r--r--server/test.lua12
2 files changed, 16 insertions, 8 deletions
diff --git a/server/publish.lua b/server/publish.lua
index a271e480..ba0d0881 100644
--- a/server/publish.lua
+++ b/server/publish.lua
@@ -1,10 +1,14 @@
+local currentPath = debug.getinfo(1, 'S').source:sub(2)
+local rootPath = currentPath:gsub('[/\\][^/\\]-$', '')
+package.cpath = rootPath .. '/bin/?.so'
+ .. ';' .. rootPath .. '/bin/?.dll'
+package.path = rootPath .. '/src/?.lua'
+ .. ';' .. rootPath .. '/src/?/init.lua'
+
local fs = require 'bee.filesystem'
local subprocess = require 'bee.subprocess'
-
-ROOT = fs.current_path()
+ROOT = fs.path(rootPath)
EXTENSION = ROOT:parent_path()
-package.path = (ROOT / 'src' / '?.lua'):string()
- .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string()
require 'utility'
local json = require 'json'
diff --git a/server/test.lua b/server/test.lua
index d39edda4..a83990c7 100644
--- a/server/test.lua
+++ b/server/test.lua
@@ -1,9 +1,13 @@
+local currentPath = debug.getinfo(1, 'S').source:sub(2)
+local rootPath = currentPath:gsub('[/\\][^/\\]-$', '')
+package.cpath = rootPath .. '/bin/?.so'
+ .. ';' .. rootPath .. '/bin/?.dll'
+package.path = rootPath .. '/src/?.lua'
+ .. ';' .. rootPath .. '/src/?/init.lua'
+
local fs = require 'bee.filesystem'
local subprocess = require 'bee.subprocess'
-
-ROOT = fs.current_path()
-package.path = (ROOT / 'src' / '?.lua'):string()
- .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string()
+ROOT = fs.path(rootPath)
local function runTest(root)
local is_macos = package.cpath:sub(-3) == '.so'