From d453f54d98536eb3a52daebfe279c4e624979c31 Mon Sep 17 00:00:00 2001 From: Daniil Rozanov Date: Mon, 18 Mar 2024 02:50:16 +0300 Subject: fix: search build directories now depends on config.build_dir --- lua/cmake-explorer/config.lua | 2 +- lua/cmake-explorer/project.lua | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lua') 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 -- cgit v1.2.3