From 7af57e8d1416f8488ce778d7f3da10041bdf45b2 Mon Sep 17 00:00:00 2001 From: sumneko Date: Wed, 29 May 2019 09:47:21 +0800 Subject: =?UTF-8?q?=E6=8D=A2=E4=B8=AA=E5=81=9A=E6=B3=95=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'server/main.lua') diff --git a/server/main.lua b/server/main.lua index 9c258b22..681135d5 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,16 +1,12 @@ -local function findExe() - local n = 0 - while true do - if not arg[n-1] then - return arg[n] - end - n = n - 1 - end -end +local currentPath = debug.getinfo(1, 'S').source:sub(2) +local rootPath = currentPath:gsub('[/\\][^/\\]-$', '') +package.cpath = rootPath .. '/bin/?.dll' + .. ';' .. rootPath .. '/bin/?.so' +package.path = rootPath .. '/src/?.lua' + .. ';' .. rootPath .. '/src/?/init.lua' local fs = require 'bee.filesystem' - -ROOT = fs.path(findExe()):parent_path():parent_path() +ROOT = fs.path(rootPath) LANG = LANG or 'en-US' package.path = (ROOT / 'src' / '?.lua'):string() -- cgit v1.2.3