From 1306f86a651bf3d7544b75d28eeb593cd5f50663 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 12 May 2025 09:31:27 -0400 Subject: [PATCH] chore: removed redundant lines in templates --- lua/Polydev/languages/cpp.lua | 2 +- lua/Polydev/templates.lua | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/Polydev/languages/cpp.lua b/lua/Polydev/languages/cpp.lua index 4f087c5..e38545f 100644 --- a/lua/Polydev/languages/cpp.lua +++ b/lua/Polydev/languages/cpp.lua @@ -12,7 +12,7 @@ end function M.run() local root = utils.get_project_root() - local cmd = { "cd " .. root, "build", " && cmake --build ." } + local cmd = { "cd " .. root, "build && cmake --build ." } local output = vim.fn.system(table.concat(cmd, "/")) if not vim.v.shell_error == 0 then diff --git a/lua/Polydev/templates.lua b/lua/Polydev/templates.lua index a21ff66..03846d5 100644 --- a/lua/Polydev/templates.lua +++ b/lua/Polydev/templates.lua @@ -232,7 +232,6 @@ M.aux_files = { c = { run = function (file_name) if not file_name then return print("Header file creation canceled") end - local root = utils.get_project_root() local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_H" local content = string.format([[ #ifndef %s @@ -242,13 +241,12 @@ M.aux_files = { #endif ]], guard_macro, guard_macro) - utils.write_file({ root, "include", file_name .. ".h" }, content) + utils.write_file({ utils.get_project_root(), "include", file_name .. ".h" }, content) end }, cpp = { run = function(file_name) if not file_name then return print("Header file creation canceled") end - local root = utils.get_project_root() local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_HPP" local content = string.format([[ #ifndef %s @@ -258,7 +256,7 @@ M.aux_files = { #endif ]], guard_macro, guard_macro, guard_macro) - utils.write_file({ root, "include", file_name .. ".hpp" }, content) + utils.write_file({ utils.get_project_root(), "include", file_name .. ".hpp" }, content) end } }