summaryrefslogtreecommitdiff
path: root/script/platform.lua
blob: 5384ad3df4e31428c760ab5dc312e497f0bebefa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local currentPath = debug.getinfo(1, 'S').source:sub(2)
local rootPath = currentPath:gsub('[^/\\]-$', '')
if package.loadlib(rootPath .. 'Windows/bin/bee.dll', 'luaopen_bee_platform') then
    if rootPath == '' then
        rootPath = '.\\'
    end
    package.cpath = rootPath .. 'Windows\\bin\\?.dll'
    package.path  = rootPath .. 'src\\?.lua'
          .. ';' .. rootPath .. 'src\\?\\init.lua'
elseif package.loadlib(rootPath .. 'macOS/bin/bee.so', 'luaopen_bee_platform') then
    if rootPath == '' then
        rootPath = './'
    end
    package.cpath = rootPath .. 'macOS/bin/?.so'
    package.path  = rootPath .. 'src/?.lua'
          .. ';' .. rootPath .. 'src/?/init.lua'
elseif package.loadlib(rootPath .. 'Linux/bin/bee.so', 'luaopen_bee_platform') then
    if rootPath == '' then
        rootPath = './'
    end
    package.cpath = rootPath .. 'Linux/bin/?.so'
    package.path  = rootPath .. 'src/?.lua'
          .. ';' .. rootPath .. 'src/?/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