From 9922b6fb2e07e9e4731accdbe8298fada4c6c5ba Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 10 Mar 2025 14:37:44 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index ee88fd9..3b410f0 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -242,32 +242,16 @@ function M.build() return end - -- 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 - end - - -- Extract the project name from the .txt file's name (without the .txt extension) - local project_name = vim.fn.fnamemodify(files[1], ":r") -- :r removes the file extension - - -- Build command - local compile_command = "cd " .. build_dir .. " && cmake .. && make && chmod +x " .. project_name - -- Open floating terminal to execute the build command + local compile_command = "cd " .. build_dir .. " && cmake .. && make" local term_buf = M.open_float_terminal(compile_command) vim.api.nvim_buf_set_option(term_buf, "modifiable", true) - -- Run compile command and capture output local compile_status = vim.fn.system(compile_command) - - -- Set message based on compile result local message if vim.v.shell_error ~= 0 then message = {"Error during compilation:"} + -- Add each line of the compile_status as individual strings in the message array for _, line in ipairs(vim.split(compile_status, "\n")) do table.insert(message, line) end