Fix absolute and relative paths

This commit is contained in:
Folkert Kevelam 2025-08-24 17:59:49 +02:00
parent c4f6e0a33d
commit 245f34e1e1

View File

@ -20,7 +20,8 @@ end
app = { app = {
cmd = nil, cmd = nil,
channel = nil channel = nil,
cwd = nil
} }
function app:init(on_exit) function app:init(on_exit)
@ -28,9 +29,9 @@ function app:init(on_exit)
return return
end end
local cwd = debug.getinfo(1, 'S').source:sub(2):match('(.*[/\\])') self.cwd = debug.getinfo(1, 'S').source:sub(2):match('(.*[/\\])')
self.channel = vim.fn.jobstart(self.cmd, { self.channel = vim.fn.jobstart(self.cmd, {
cwd = cwd, cwd = self.cwd,
stderr_buffered = true, stderr_buffered = true,
on_exit = function() on_exit = function()
vim.fn.chanclose(self.channel) vim.fn.chanclose(self.channel)
@ -75,11 +76,13 @@ function module.setup()
setmetatable(o, app) setmetatable(o, app)
app.__index = app app.__index = app
local cwd = debug.getinfo(1, 'S').source:sub(2):match('(.*[/\\])')
local base_location = cwd:gsub("lua/MarkdownPreviewer", "")
o.cmd = { o.cmd = {
"../../Server/run.sh", base_location .. "Server/test.pex",
"../../Server/venv", "--base",
'python3', base_location
'../../Server/server.py'
} }
return o return o