diff options
-rw-r--r-- | lua/cmake-explorer/config.lua | 2 | ||||
-rw-r--r-- | lua/cmake-explorer/project.lua | 8 |
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 |