fix: cmd and path now work with paths containing spaces (#483)

This commit is contained in:
m10090 2024-04-22 15:21:58 +02:00 committed by GitHub
parent c1b8f7eb62
commit f059a52c3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,7 +93,14 @@ local term_exec_options = {
local commands = {}
for _, path in ipairs(paths) do
local glob_str = path .. "/" .. (typed_cmd or "") .. "*"
local glob_str
if string.match(path, "%s*") then
--path with spaces
glob_str = path:gsub(" ", "\\ ") .. "/" .. (typed_cmd or "") .. "*"
else
-- path without spaces
glob_str = path .. "/" .. (typed_cmd or "") .. "*"
end
local dir_cmds = vim.split(vim.fn.glob(glob_str), "\n")
for _, cmd in ipairs(dir_cmds) do