From 4f330d4a9fee6ba99322ef1e1c6d5a2d8144d444 Mon Sep 17 00:00:00 2001 From: sumneko Date: Wed, 29 May 2019 18:24:02 +0800 Subject: =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.lua | 5 ++++- server/publish.lua | 7 +++++-- 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' -- cgit v1.2.3