From 0637fa4b3415a7a74e3c621b73ecbf967f0bff78 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 10 Mar 2025 14:26:11 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index 17d1a7d..04d899b 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -296,13 +296,21 @@ function M.run() -- Define the build directory local build_dir = project_root .. "/build" - -- List only .txt files in the build directory and filter out unwanted ones like CMakeCache.txt + -- List only .txt files in the build directory local files = vim.fn.glob(build_dir .. "/*.txt", true, true) + + -- Debugging: Print out the list of files detected + print("Files in build directory:") + for _, file in ipairs(files) do + print(file) + end + local project_name = nil + -- Check each file in the build directory for _, file in ipairs(files) do -- Make sure the file is the correct project name file (not CMakeCache.txt or others) - if not vim.fn.match(file, "CMakeCache.txt") then + if vim.fn.match(file, "CMakeCache.txt") == -1 then -- Extract the project name (remove the extension) project_name = vim.fn.fnamemodify(file, ":r") break