1
0
forked from 0ad/0ad

Fix pathname not matching name incompatible mod detection

Differential revision: D4324
Broken in 498f0d420b

This was SVN commit r25979.
This commit is contained in:
Angen 2021-10-28 20:33:01 +00:00
parent 3ab25cbd95
commit 5924575705
2 changed files with 21 additions and 1 deletions

View File

@ -293,7 +293,7 @@ std::vector<CStr> Mod::CheckForIncompatibleMods(const std::vector<CStr>& mods) c
}
modNameVersions.emplace(it->m_Name, it->m_Version);
modDependencies.emplace(it->m_Name, it->m_Dependencies);
modDependencies.emplace(it->m_Pathname, it->m_Dependencies);
}
static const std::vector<CStr> toCheck = { "<=", ">=", "=", "<", ">" };

View File

@ -134,6 +134,26 @@ public:
TS_ASSERT(m_Mods.CheckForIncompatibleMods(mods).size() == 1);
}
void test_different_name_and_path()
{
ScriptInterface script("Test", "Test", g_ScriptContext);
ScriptRequest rq(script);
JS::RootedObject obj(rq.cx, JS_NewPlainObject(rq.cx));
m_Mods.m_AvailableMods = {
Mod::ModData{ "public", "0ad", "0.0.25", {}, false, "" },
Mod::ModData{ "wrong", "wrong_name", "0.10.0", { "0ad=0.0.24" }, false, ""}
};
std::vector<CStr> mods;
mods.clear();
mods.push_back("public");
mods.push_back("wrong");
TS_ASSERT(!m_Mods.CheckForIncompatibleMods(mods).empty());
}
void test_play_compatible()
{
Mod::ModData a1 = { "a", "a", "0.0.1", {}, false, "" };