diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-03-29 01:28:24 -0600 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2024-03-29 03:03:55 -0600 |
| commit | 81b8f66587f4f04c8c5db565dd6380ee692d7539 (patch) | |
| tree | a5dbb1524f6abfc5c758e7fb9d2861d04b7f44f2 | |
| parent | c7c512e7a0d3f10218e251a243396a02c026c84b (diff) | |
Fixed detection on multiple export formats
| -rw-r--r-- | src/Companion.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index 40870c2..f3b782f 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -418,13 +418,14 @@ std::string ExportTypeToString(ExportType type) { bool Companion::NodeHasChanges(const std::string& path) { - if(this->gConfig.exporterType == ExportType::Modding) { + if(this->gConfig.modding) { return true; } std::ifstream yaml(path); const std::vector<uint8_t> data = std::vector<uint8_t>(std::istreambuf_iterator( yaml ), {}); this->gCurrentHash = CalculateHash(data); + bool needsInit = true; if(this->gHashNode[path]) { auto entry = GetSafeNode<YAML::Node>(this->gHashNode, path); @@ -432,17 +433,22 @@ bool Companion::NodeHasChanges(const std::string& path) { auto modes = GetSafeNode<YAML::Node>(entry, "extracted"); auto extracted = GetSafeNode<bool>(modes, ExportTypeToString(this->gConfig.exporterType)); - if(hash == this->gCurrentHash && extracted) { - SPDLOG_INFO("Skipping {} as it has not changed", path); - return false; + if(hash == this->gCurrentHash) { + needsInit = false; + if(extracted) { + SPDLOG_INFO("Skipping {} as it has not changed", path); + return false; + } } } - this->gHashNode[path] = YAML::Node(); - this->gHashNode[path]["hash"] = this->gCurrentHash; - this->gHashNode[path]["extracted"] = YAML::Node(); - for(size_t m = 0; m < static_cast<size_t>(ExportType::Modding); m++) { - this->gHashNode[path]["extracted"][ExportTypeToString(static_cast<ExportType>(m))] = false; + if(needsInit) { + this->gHashNode[path] = YAML::Node(); + this->gHashNode[path]["hash"] = this->gCurrentHash; + this->gHashNode[path]["extracted"] = YAML::Node(); + for(size_t m = 0; m <= static_cast<size_t>(ExportType::Modding); m++) { + this->gHashNode[path]["extracted"][ExportTypeToString(static_cast<ExportType>(m))] = false; + } } return true; |
