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

调试器也尝试预览版vscode的路径

parent d50bbdfa
No related branches found
No related tags found
No related merge requests found
...@@ -3,19 +3,22 @@ if not DEVELOP then ...@@ -3,19 +3,22 @@ if not DEVELOP then
end end
local fs = require 'bee.filesystem' local fs = require 'bee.filesystem'
local extensionPath = fs.path(os.getenv 'USERPROFILE' or '') / '.vscode' / 'extensions' local luaDebugs = {}
for _, vscodePath in ipairs {'.vscode', '.vscode-insiders'} do
local extensionPath = fs.path(os.getenv 'USERPROFILE' or '') / vscodePath / 'extensions'
log.debug('Search extensions at:', extensionPath:string()) log.debug('Search extensions at:', extensionPath:string())
if not fs.is_directory(extensionPath) then if not fs.is_directory(extensionPath) then
log.debug('Extension path is not a directory.') log.debug('Extension path is not a directory.')
return return
end end
local luaDebugs = {}
for path in extensionPath:list_directory() do for path in extensionPath:list_directory() do
if fs.is_directory(path) then if fs.is_directory(path) then
local name = path:filename():string() local name = path:filename():string()
if name:find('actboy168.lua-debug-', 1, true) then if name:find('actboy168.lua-debug-', 1, true) then
luaDebugs[#luaDebugs+1] = name luaDebugs[#luaDebugs+1] = path:string()
end
end end
end end
end end
...@@ -37,13 +40,13 @@ table.sort(luaDebugs, function (a, b) ...@@ -37,13 +40,13 @@ table.sort(luaDebugs, function (a, b)
return getVer(a) > getVer(b) return getVer(a) > getVer(b)
end) end)
local debugPath = extensionPath / luaDebugs[1] local debugPath = luaDebugs[1]
local cpath = "/runtime/win64/lua54/?.dll" local cpath = "/runtime/win64/lua54/?.dll"
local path = "/script/?.lua" local path = "/script/?.lua"
local function tryDebugger() local function tryDebugger()
local entry = assert(package.searchpath('debugger', debugPath:string() .. path)) local entry = assert(package.searchpath('debugger', debugPath .. path))
local root = debugPath:string() local root = debugPath
local addr = ("127.0.0.1:%d"):format(DBGPORT) local addr = ("127.0.0.1:%d"):format(DBGPORT)
local dbg = loadfile(entry)(root) local dbg = loadfile(entry)(root)
dbg:start(addr) dbg:start(addr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment