summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-27 09:59:13 +0800
committersumneko <sumneko@hotmail.com>2019-05-27 09:59:13 +0800
commit85328f177a6783fab57283b28a0ce9ff0f32402f (patch)
tree7621c661f9440daf1aee3b5aaecc7c98a3d950b2 /server
parent71eef9f8ae04187f33ed3ecd09d16e22fc83d785 (diff)
downloadlua-language-server-85328f177a6783fab57283b28a0ce9ff0f32402f.zip
#39 不再依赖 CWD
Diffstat (limited to 'server')
-rw-r--r--server/main.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/main.lua b/server/main.lua
index ac7860c5..9c258b22 100644
--- a/server/main.lua
+++ b/server/main.lua
@@ -1,6 +1,16 @@
+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 fs = require 'bee.filesystem'
-ROOT = fs.current_path()
+ROOT = fs.path(findExe()):parent_path():parent_path()
LANG = LANG or 'en-US'
package.path = (ROOT / 'src' / '?.lua'):string()