From 714cc7d99fb36e6cc31c3b1d569bbfd3f4c533ee Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 10 Mar 2025 14:33:51 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index ee88fd9..7b0a2e3 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -244,12 +244,14 @@ function M.build() -- Define the build directory local build_dir = project_root .. "/build" - -- List files in the build directory and find the .txt file local files = vim.fn.glob(build_dir .. "/*.txt", true, true) - if #files == 0 then - print("Error: No .txt file found in the build directory.") - return + local project_name = nil + for _, file in ipairs(files) do + if vim.fn.match(file, "CMakeCache.txt") == -1 then + project_name = vim.fn.fnamemodify(file, ":r") + break + end end -- Extract the project name from the .txt file's name (without the .txt extension)