Update c.lua

This commit is contained in:
DarthMooMancer
2025-03-10 13:04:48 -04:00
parent 8fe0129593
commit 16d4fe60ab
+9 -3
View File
@@ -4,7 +4,6 @@ M.c_build = nil
M.c_run = nil
M.new_c_file = nil
M.new_c_project = nil
M.project_name = nil
-- Default config
M.config = {
@@ -133,7 +132,6 @@ function M.create_project()
end
-- Paths for the project
M.project_name = project_name
local project_root = vim.fn.expand(M.config.project_root) .. "/" .. project_name
local src_dir = project_root .. "/src"
local build_dir = project_root .. "/build"
@@ -232,7 +230,13 @@ function M.build()
-- local compile_command = "mv " .. legacy_src_dir .. "/* " .. src_dir ..
-- " && mv " .. legacy_out_dir .. "/* " .. build_dir ..
-- " && rm -rd " .. project_root .. "/" .. "root/"
local project_root = vim.fn.expand(M.config.project_root) .. "/" .. M.project_name
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
if not project_name or project_name == "" then
print("Project creation canceled.")
return
end
local project_root = vim.fn.expand(M.config.project_root) .. "/" .. project_name
local into_build = "cd " .. project_root .. "/build"
local into_build_status = vim.fn.system(into_build)
if vim.v.shell_error ~= 0 then
@@ -253,8 +257,10 @@ function M.build()
else
print("Compilation successful!")
end
end)
end
-- Run Java program in floating terminal
function M.run()
local current_dir = vim.fn.expand("%:p:h")