mirror of
https://github.com/minetest/minetest.git
synced 2025-03-06 20:48:40 +01:00
Make sure mod paths are always absolute
This commit is contained in:
parent
d0d7c11fe1
commit
903d13ffff
3 changed files with 8 additions and 4 deletions
|
@ -47,7 +47,7 @@ void ModConfiguration::addMods(const std::vector<ModSpec> &new_mods)
|
|||
}
|
||||
|
||||
// Add new mods
|
||||
for (int want_from_modpack = 1; want_from_modpack >= 0; --want_from_modpack) {
|
||||
for (bool want_from_modpack : {true, false}) {
|
||||
// First iteration:
|
||||
// Add all the mods that come from modpacks
|
||||
// Second iteration:
|
||||
|
@ -56,9 +56,12 @@ void ModConfiguration::addMods(const std::vector<ModSpec> &new_mods)
|
|||
std::set<std::string> seen_this_iteration;
|
||||
|
||||
for (const ModSpec &mod : new_mods) {
|
||||
if (mod.part_of_modpack != (bool)want_from_modpack)
|
||||
if (mod.part_of_modpack != want_from_modpack)
|
||||
continue;
|
||||
|
||||
// unrelated to this code, but we want to assert it somewhere
|
||||
assert(fs::IsPathAbsolute(mod.path));
|
||||
|
||||
if (existing_mods.count(mod.name) == 0) {
|
||||
// GOOD CASE: completely new mod.
|
||||
m_unsatisfied_mods.push_back(mod);
|
||||
|
|
|
@ -167,6 +167,7 @@ std::map<std::string, ModSpec> getModsInPath(
|
|||
|
||||
mod_path.clear();
|
||||
mod_path.append(path).append(DIR_DELIM).append(modname);
|
||||
mod_path = fs::AbsolutePath(mod_path);
|
||||
|
||||
mod_virtual_path.clear();
|
||||
// Intentionally uses / to keep paths same on different platforms
|
||||
|
@ -174,7 +175,7 @@ std::map<std::string, ModSpec> getModsInPath(
|
|||
|
||||
ModSpec spec(modname, mod_path, part_of_modpack, mod_virtual_path);
|
||||
parseModContents(spec);
|
||||
result.insert(std::make_pair(modname, spec));
|
||||
result[modname] = std::move(spec);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ struct ModSpec
|
|||
{
|
||||
std::string name;
|
||||
std::string author;
|
||||
std::string path;
|
||||
std::string path; // absolute path on disk
|
||||
std::string desc;
|
||||
int release = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue