From 2bbe89273d82ab7a1c32f14d6ea9e06cc4f43925 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:32:32 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index 1979318..c55d835 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -149,8 +149,8 @@ end function M.create_new_header_file() vim.ui.input({ prompt = "Enter header file name: " }, function(header_name) if not header_name then return print("Header file creation canceled.") end - local root_dir = vim.fn.expand("%:p:h"):match("(.*)/src") - if not root_dir then return print("Error: src directory not found.") end + local root_dir = M.get_project_root() + if not root_dir then return print("Error: Project root not found.") end local guard_macro = header_name:upper():gsub("[^A-Z0-9]", "_") .. "_H" local content = string.format([[ #ifndef %s