summaryrefslogtreecommitdiff
path: root/server/platform.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/platform.lua')
-rw-r--r--server/platform.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/platform.lua b/server/platform.lua
new file mode 100644
index 00000000..cfed5287
--- /dev/null
+++ b/server/platform.lua
@@ -0,0 +1,16 @@
+local currentPath = debug.getinfo(1, 'S').source:sub(2)
+local rootPath = currentPath:gsub('[^/\\]-$', '')
+if rootPath == '' then
+ rootPath = './'
+end
+
+package.path = rootPath .. 'src/?.lua'
+ .. ';' .. rootPath .. 'src/?/init.lua'
+
+if package.loadlib(rootPath .. '/bin-macos/bee.so', 'luaopen_bee_platform') then
+ package.cpath = rootPath .. 'bin-macos/?.so'
+elseif package.loadlib(rootPath .. '/bin-linux/bee.so', 'luaopen_bee_platform') then
+ package.cpath = rootPath .. 'bin-linux/?.so'
+elseif package.loadlib(rootPath .. '/bin-windows/bee.dll', 'luaopen_bee_platform') then
+ package.cpath = rootPath .. 'bin-windows/?.dll'
+end