Update c.lua

This commit is contained in:
DarthMooMancer
2025-03-10 14:33:51 -04:00
parent effb7f32b8
commit 714cc7d99f
+6 -4
View File
@@ -244,12 +244,14 @@ function M.build()
-- Define the build directory -- Define the build directory
local build_dir = project_root .. "/build" local build_dir = project_root .. "/build"
-- List files in the build directory and find the .txt file -- List files in the build directory and find the .txt file
local files = vim.fn.glob(build_dir .. "/*.txt", true, true) local files = vim.fn.glob(build_dir .. "/*.txt", true, true)
if #files == 0 then local project_name = nil
print("Error: No .txt file found in the build directory.") for _, file in ipairs(files) do
return if vim.fn.match(file, "CMakeCache.txt") == -1 then
project_name = vim.fn.fnamemodify(file, ":r")
break
end
end end
-- Extract the project name from the .txt file's name (without the .txt extension) -- Extract the project name from the .txt file's name (without the .txt extension)