Skip to content
Snippets Groups Projects
Commit bdd3f349 authored by 最萌小汐's avatar 最萌小汐
Browse files

更新platform

parent 78b54ce5
No related branches found
No related tags found
No related merge requests found
local script = ...
local currentPath = debug.getinfo(1, 'S').source:sub(2)
local rootPath = currentPath:gsub('[^/\\]-$', '')
if package.loadlib(rootPath .. 'bin/Windows/bee.dll', 'luaopen_bee_platform') then
if rootPath == '' then
rootPath = '.\\'
else
rootPath = rootPath:gsub('/', '\\')
local function findExePath()
local n = 0
while arg[n-1] do
n = n - 1
end
package.cpath = rootPath .. 'bin\\Windows\\?.dll'
package.path = rootPath .. script .. '\\?.lua'
.. ';' .. rootPath .. script .. '\\?\\init.lua'
elseif package.loadlib(rootPath .. 'bin/macOS/bee.so', 'luaopen_bee_platform') then
if rootPath == '' then
rootPath = './'
return arg[n]
end
package.cpath = rootPath .. 'macOS/bin/?.so'
package.path = rootPath .. script .. '/?.lua'
.. ';' .. rootPath .. script .. '/?/init.lua'
elseif package.loadlib(rootPath .. 'bin/Linux/bee.so', 'luaopen_bee_platform') then
if rootPath == '' then
rootPath = './'
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('bee'..dll, 'luaopen_bee_platform') then
error([[It doesn't seem to support your OS, please let me know at https://github.com/sumneko/lua-language-server/issues]])
end
package.cpath = rootPath .. 'bin/Linux/?.so'
local fs = require 'bee.filesystem'
local rootPath = fs.path(exePath):parent_path():parent_path():remove_filename():string()
if dll == '.dll' then
rootPath = rootPath:gsub('/', '\\')
package.path = rootPath .. script .. '\\?.lua'
.. ';' .. rootPath .. script .. '\\?\\init.lua'
else
rootPath = rootPath:gsub('\\', '/')
package.path = rootPath .. script .. '/?.lua'
.. ';' .. rootPath .. script .. '/?/init.lua'
else
error([[It doesn't seem to support your OS, please let me know at https://github.com/sumneko/lua-language-server/issues]])
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment