mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix cached plugin CRCs failing checksum conditions
If a plugin's CRC value was cached, it would cause any condition that checks it to evaluate to false. This wouldn't occur when LOOT is launched, but could have caused messages to disappear if the masterlist was re-evaluated after sorting.
This commit is contained in:
@@ -135,8 +135,6 @@ bool ConditionEvaluator::checksumMatches(const std::string& filePath, const uint
|
||||
realChecksum = GetCrc32(game_->DataPath() / filePath);
|
||||
else if ((boost::iends_with(filePath, ".esp") || boost::iends_with(filePath, ".esm")) && boost::filesystem::exists(game_->DataPath() / (filePath + ".ghost")))
|
||||
realChecksum = GetCrc32(game_->DataPath() / (filePath + ".ghost"));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,6 +247,21 @@ TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatMatchesTheActualPlugi
|
||||
EXPECT_TRUE(result_);
|
||||
}
|
||||
|
||||
TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatMatchesTheActualCachedPluginCrcShouldEvaluateToTrue) {
|
||||
ASSERT_NO_THROW(game_.LoadAllInstalledPlugins(false));
|
||||
|
||||
Grammar grammar(&game_);
|
||||
std::string condition("checksum(\"" + blankEsm + "\", " + IntToHexString(blankEsmCrc) + ")");
|
||||
|
||||
success_ = boost::spirit::qi::phrase_parse(std::cbegin(condition),
|
||||
std::cend(condition),
|
||||
grammar,
|
||||
skipper_,
|
||||
result_);
|
||||
EXPECT_TRUE(success_);
|
||||
EXPECT_TRUE(result_);
|
||||
}
|
||||
|
||||
TEST_P(ConditionGrammarTest, aChecksumConditionWithACrcThatDoesNotMatchTheActualPluginCrcShouldEvaluateToFalse) {
|
||||
Grammar grammar(&game_);
|
||||
std::string condition("checksum(\"" + blankEsm + "\", DEADBEEF)");
|
||||
|
||||
Reference in New Issue
Block a user