Skip to content

Commit

Permalink
fix: replace backslashes on Windows for pattern (#273)
Browse files Browse the repository at this point in the history
Co-authored-by: thisRedH <[email protected]>
  • Loading branch information
thisRedH and thisRedH authored Dec 22, 2024
1 parent a52e20a commit 1b5892f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/cmake-tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,11 @@ function cmake.create_regenerate_on_save_autocmd()
table.insert(pattern, ss)
end

local cwd = config.cwd
if require("cmake-tools.osys").iswin32 then
cwd = config.cwd:gsub("\\", "/")
end

local presets_exists = config.base_settings.use_preset and Presets.exists(config.cwd)
if presets_exists then
for _, item in ipairs({
Expand All @@ -1409,7 +1414,7 @@ function cmake.create_regenerate_on_save_autocmd()
"cmake-presets.json",
"cmake-user-presets.json",
}) do
table.insert(pattern, config.cwd .. "/" .. item)
table.insert(pattern, cwd .. "/" .. item)
end
else
for _, item in ipairs({
Expand All @@ -1420,7 +1425,7 @@ function cmake.create_regenerate_on_save_autocmd()
"CMakeKits.json",
"cmake-kits.json",
}) do
table.insert(pattern, config.cwd .. "/" .. item)
table.insert(pattern, cwd .. "/" .. item)
end
end

Expand Down

0 comments on commit 1b5892f

Please sign in to comment.