diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-27 09:59:13 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-27 09:59:13 +0800 |
commit | 85328f177a6783fab57283b28a0ce9ff0f32402f (patch) | |
tree | 7621c661f9440daf1aee3b5aaecc7c98a3d950b2 /server | |
parent | 71eef9f8ae04187f33ed3ecd09d16e22fc83d785 (diff) | |
download | lua-language-server-85328f177a6783fab57283b28a0ce9ff0f32402f.zip |
#39 不再依赖 CWD
Diffstat (limited to 'server')
-rw-r--r-- | server/main.lua | 12 |
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() |