summaryrefslogtreecommitdiff
path: root/platform.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-30 01:21:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-30 01:21:42 +0800
commitb237d03564a8fd7a4c458468262a20882f9426d0 (patch)
treed8b8cf7eca01d36694491ea121ed2e23907a5d30 /platform.lua
parent27a141bb779c3e048b17b2d49071ac1f072662af (diff)
downloadlua-language-server-b237d03564a8fd7a4c458468262a20882f9426d0.zip
#110 更新cpath计算方式
Diffstat (limited to 'platform.lua')
-rw-r--r--platform.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/platform.lua b/platform.lua
index 5a4751b7..db62f939 100644
--- a/platform.lua
+++ b/platform.lua
@@ -9,11 +9,21 @@ local function findExePath()
end
local exePath = findExePath()
-local exeDir = exePath:gsub('[^/\\]-$', '')
-local dll = exePath:sub(-4) == '.exe' and '.dll' or '.so'
-package.cpath = exeDir .. '?' .. dll
-if not package.loadlib(exeDir..'bee'..dll, 'luaopen_bee_platform') then
- error([[It doesn't seem to support your OS, please build it in your OS, see https://github.com/sumneko/vscode-lua/wiki/Build]])
+local exeDir = exePath:match('(.+)[/\\][%w_.-]+$')
+local dll = package.cpath:match '[/\\]%?%.([a-z]+)'
+package.cpath = ('%s/?.%s'):format(exeDir, dll)
+if not package.loadlib(exeDir..'/bee.'..dll, 'luaopen_bee_platform') then
+ error(([[It doesn't seem to support your OS, please build it in your OS, see https://github.com/sumneko/vscode-lua/wiki/Build
+exePath: %s
+exeDir: %s
+dll: %s
+cpath: %s
+]]):format(
+ exePath,
+ exeDir,
+ dll,
+ package.cpath
+))
end
local fs = require 'bee.filesystem'