From f1d7a1903e49c75f9965693247e8d102a96b482c Mon Sep 17 00:00:00 2001 From: frosty Date: Wed, 22 Apr 2026 22:30:21 -0400 Subject: misc optimisations and QoL improvements --- src/build.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/build.cc') diff --git a/src/build.cc b/src/build.cc index adbfec5..88b40c7 100644 --- a/src/build.cc +++ b/src/build.cc @@ -9,11 +9,22 @@ void build(std::filesystem::path build_dir) { if (build_dir != std::filesystem::current_path().string()) { std::filesystem::current_path(build_dir); } + + bool bldit_found = false; + bool build_found = false; + for (auto const &dir_entry : std::filesystem::directory_iterator(std::filesystem::current_path().string())) { - if (dir_entry.path().filename() == "bldit") { system("./bldit"); return; } + if (dir_entry.path().filename() == "bldit") { + bldit_found = true; + break; + } } - for (auto const &dir_entry : std::filesystem::directory_iterator(std::filesystem::current_path().string())) { - if (lua_build(build_dir.c_str())) { return; } + + if (bldit_found) { + system("./bldit"); + } else if (lua_build(build_dir.c_str())) { + return; + } else { + std::cout << print_error << "no usable build system was found\n"; } - std::cout << print_error << "no usable build system was found\n"; } \ No newline at end of file -- cgit v1.2.3