From 8eb672c4a1854d2189face91b408a20725cf4432 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 10 Mar 2025 14:30:39 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index f46ec52..5dfa6ac 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -285,7 +285,7 @@ end function M.run() local current_dir = vim.fn.expand("%:p:h") local project_root = current_dir:match("(.*)/src") - + if not project_root then print("Error: src directory not found.") return @@ -293,6 +293,7 @@ function M.run() local build_dir = project_root .. "/build" local files = vim.fn.glob(build_dir .. "/*.txt", true, true) + local project_name = nil for _, file in ipairs(files) do if vim.fn.match(file, "CMakeCache.txt") == -1 then @@ -306,7 +307,9 @@ function M.run() return end - M.open_float_terminal("cd " .. build_dir .. " && ." .. project_name) + -- Ensure the project_name is being used correctly in the command + local executable_path = build_dir .. "/" .. project_name + M.open_float_terminal("cd " .. build_dir .. " && ./" .. project_name) end return M