diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-29 18:24:02 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-29 18:24:02 +0800 |
commit | 4f330d4a9fee6ba99322ef1e1c6d5a2d8144d444 (patch) | |
tree | e11a970d4180c14175cfaee9a3ca57b157f70f58 /server | |
parent | 63145ea05075725ee8fd8e258aa30ffc57ab0cce (diff) | |
download | lua-language-server-4f330d4a9fee6ba99322ef1e1c6d5a2d8144d444.zip |
测试
Diffstat (limited to 'server')
-rw-r--r-- | server/main.lua | 5 | ||||
-rw-r--r-- | server/publish.lua | 7 | ||||
-rw-r--r-- | 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' |