From b237d03564a8fd7a4c458468262a20882f9426d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 30 Nov 2019 01:21:42 +0800 Subject: =?UTF-8?q?#110=20=E6=9B=B4=E6=96=B0cpath=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'platform.lua') 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' -- cgit v1.2.3