summaryrefslogtreecommitdiff
path: root/server-beta/debugger.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/debugger.lua')
-rw-r--r--server-beta/debugger.lua56
1 files changed, 0 insertions, 56 deletions
diff --git a/server-beta/debugger.lua b/server-beta/debugger.lua
deleted file mode 100644
index 113fa687..00000000
--- a/server-beta/debugger.lua
+++ /dev/null
@@ -1,56 +0,0 @@
-local wait = ...
-local fs = require 'bee.filesystem'
-local extensionPath = fs.path(os.getenv 'USERPROFILE') / '.vscode' / 'extensions'
-log.debug('Search extensions at:', extensionPath:string())
-if not fs.is_directory(extensionPath) then
- log.debug('Extension path is not a directory.')
- return
-end
-
-local luaDebugs = {}
-for path in extensionPath:list_directory() do
- if fs.is_directory(path) then
- local name = path:filename():string()
- if name:find('actboy168.lua-debug-', 1, true) then
- luaDebugs[#luaDebugs+1] = name
- end
- end
-end
-
-if #luaDebugs == 0 then
- log.debug('Cant find "actboy168.lua-debug"')
- return
-end
-
-local function getVer(filename)
- local a, b, c = filename:match('(%d+)%.(%d+)%.(%d+)$')
- if not a then
- return 0
- end
- return a * 1000000 + b * 1000 + c
-end
-
-table.sort(luaDebugs, function (a, b)
- return getVer(a) > getVer(b)
-end)
-
-local debugPath = extensionPath / luaDebugs[1]
-local cpath = "/runtime/win64/lua54/?.dll"
-local path = "/script/?.lua"
-
-local function tryDebugger()
- local entry = assert(package.searchpath('debugger', debugPath:string() .. path))
- local root = debugPath:string()
- local port = '11412'
- local addr = "127.0.0.1:" .. port
- local dbg = loadfile(entry)('windows', root)
- dbg:start(addr)
- log.debug('Debugger startup, listen port:', port)
- log.debug('Debugger args:', addr, root, path, cpath)
- if wait == 'wait' then
- dbg:wait()
- end
- return dbg
-end
-
-xpcall(tryDebugger, log.debug)