Update c.lua
This commit is contained in:
+6
-4
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user