diff --git a/main.cpp b/main.cpp index a1329f8..94304da 100644 --- a/main.cpp +++ b/main.cpp @@ -21,6 +21,7 @@ std::string folder_char = "\\"; #else std::string folder_char = "/"; #endif +std::string loaded_section = ""; std::vector exclude; std::vector keys = {"libs", "cppflags", "executable", "sourcepath", "buildpath", "exclude"}; @@ -174,7 +175,7 @@ bool loadLagueirtoFile(const std::string §ion_to_load) if (rest == "default") found_default = true; if (section_to_load.empty() && rest == "default") active = true; else active = (current_section == section_to_load); - + if (active) loaded_section = current_section; continue; } @@ -445,14 +446,29 @@ int main(int argc, char *argv[]) exit(1); } + std::string last_config_file = build_path + folder_char + "last_config"; + if (!std::filesystem::exists(last_config_file)) { + must_recompile_all = true; + } else { + std::ifstream in(last_config_file); + if (in) { + std::string word; + in >> word; + if (word != loaded_section) must_recompile_all = true; + } + } + if (must_recompile_all) { std::cout << "remove: '" << build_path << "'" << std::endl; std::filesystem::remove_all(build_path); } + if (!std::filesystem::is_directory(build_path)) std::filesystem::create_directory(build_path); + std::ofstream out(last_config_file); + if (out) out << loaded_section; + std::chrono::steady_clock::time_point begin_all = std::chrono::steady_clock::now(); - if (!std::filesystem::is_directory(build_path)) std::filesystem::create_directory(build_path); source_paths = split(source_path); // Recopilem tots els arxius cpp i capçaleres diff --git a/version.h b/version.h index 5b14988..0f9bd14 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ #pragma once -#define LAGUEIRTO_VERSION "2.0.1" +#define LAGUEIRTO_VERSION "2.0.2"