diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index aef64a3..0dc55fb 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -283,6 +283,15 @@ function M.build() end function M.run() + -- Get the current file's directory + local current_dir = vim.fn.expand("%:p:h") + -- Try to find the root of the project by matching the path + local project_root = current_dir:match("(.*)/src") + if not project_root then + print("Error: src directory not found.") + return + end + -- Define the build directory local build_dir = project_root .. "/build"