mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix tests broken by introduction of ghosted plugin
This commit is contained in:
@@ -170,21 +170,20 @@ namespace loot {
|
||||
// First set reverse timestamps to be sure.
|
||||
time_t time = boost::filesystem::last_write_time(dataPath / masterFile);
|
||||
for (size_t i = 1; i < loadOrder.size(); ++i) {
|
||||
if (!boost::filesystem::exists(dataPath / loadOrder[i]))
|
||||
loadOrder[i] += ".ghost";
|
||||
|
||||
boost::filesystem::last_write_time(dataPath / loadOrder[i], time - i * 60);
|
||||
ASSERT_EQ(time - i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
|
||||
}
|
||||
|
||||
EXPECT_NO_THROW(game.RedatePlugins());
|
||||
|
||||
if (GetParam() == Game::tes5) {
|
||||
for (size_t i = 0; i < loadOrder.size(); ++i) {
|
||||
ASSERT_EQ(time + i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (size_t i = 0; i < loadOrder.size(); ++i) {
|
||||
ASSERT_EQ(time - i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
|
||||
}
|
||||
time_t interval = 60;
|
||||
if (GetParam() != Game::tes5)
|
||||
interval *= -1;
|
||||
for (size_t i = 0; i < loadOrder.size(); ++i) {
|
||||
EXPECT_EQ(time + i * interval, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,12 @@ namespace loot {
|
||||
if (isLoadOrderTimestampBased(GetParam())) {
|
||||
std::map<time_t, std::string> loadOrder;
|
||||
for (boost::filesystem::directory_iterator it(dataPath); it != boost::filesystem::directory_iterator(); ++it) {
|
||||
if (boost::filesystem::is_regular_file(it->status()) &&
|
||||
(boost::ends_with(it->path().filename().string(), ".esp") || boost::ends_with(it->path().filename().string(), ".esm"))) {
|
||||
loadOrder.emplace(boost::filesystem::last_write_time(it->path()), it->path().filename().string());
|
||||
if (boost::filesystem::is_regular_file(it->status())) {
|
||||
std::string filename = it->path().filename().string();
|
||||
if (boost::ends_with(filename, ".ghost"))
|
||||
filename = it->path().stem().string();
|
||||
if (boost::ends_with(filename, ".esp") || boost::ends_with(filename, ".esm"))
|
||||
loadOrder.emplace(boost::filesystem::last_write_time(it->path()), filename);
|
||||
}
|
||||
}
|
||||
for (const auto& plugin : loadOrder)
|
||||
|
||||
Reference in New Issue
Block a user