aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake-explorer
diff options
context:
space:
mode:
authorDaniil Rozanov <daniilrozzanov@gmail.com>2024-03-18 02:50:16 +0300
committerDaniil Rozanov <daniilrozzanov@gmail.com>2024-03-18 02:50:16 +0300
commitd453f54d98536eb3a52daebfe279c4e624979c31 (patch)
treee307e612e9e69f3adc9f7be411b0e03d09075411 /lua/cmake-explorer
parent6184ca819279c7e44f470a731fcca3d469f40a01 (diff)
fix: search build directories now depends on config.build_dir
Diffstat (limited to 'lua/cmake-explorer')
-rw-r--r--lua/cmake-explorer/config.lua2
-rw-r--r--lua/cmake-explorer/project.lua8
2 files changed, 8 insertions, 2 deletions
diff --git a/lua/cmake-explorer/config.lua b/lua/cmake-explorer/config.lua
index b44c7cd..21788ce 100644
--- a/lua/cmake-explorer/config.lua
+++ b/lua/cmake-explorer/config.lua
@@ -1,7 +1,7 @@
local default_config = {
cmake_cmd = "cmake",
build_dir_template = { "build", "${buildType}", sep = "-", case = nil },
- build_dir = ".",
+ build_dir = "",
build_types = { "Debug", "Release" },
options = {},
}
diff --git a/lua/cmake-explorer/project.lua b/lua/cmake-explorer/project.lua
index bdd54e3..7006656 100644
--- a/lua/cmake-explorer/project.lua
+++ b/lua/cmake-explorer/project.lua
@@ -36,7 +36,13 @@ function Project:new(o)
end
function Project:scan_build_dirs()
- local candidates = Scandir.scan_dir(self.path, { hidden = false, only_dirs = true, depth = 0, silent = true })
+ local builds_root = utils.is_eq(
+ Path:new(config.build_dir):absolute(),
+ true,
+ config.build_dir,
+ Path:new(self.path, config.build_dir):absolute()
+ )
+ local candidates = Scandir.scan_dir(builds_root, { hidden = false, only_dirs = true, depth = 0, silent = true })
for _, v in ipairs(candidates) do
local fa = FileApi:new(v)
if fa and fa:exists() and fa:read_reply() then