diff options
author | rubenwardy <rw@rubenwardy.com> | 2022-08-19 12:31:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 12:31:36 +0100 |
commit | 2d10fa786792a27adb4097abe8c92f36cf47e6ce (patch) | |
tree | 82981f63a026156ccdee66dc8650d6eea52157df /src/content/mod_configuration.cpp | |
parent | 8c29c4f620a45385ac4e906c1f50d1df7d1edba9 (diff) | |
download | minetest-2d10fa786792a27adb4097abe8c92f36cf47e6ce.tar.xz |
Prevent loading a world with unresolved dependencies (#12542)
Diffstat (limited to 'src/content/mod_configuration.cpp')
-rw-r--r-- | src/content/mod_configuration.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/content/mod_configuration.cpp b/src/content/mod_configuration.cpp index 504cdaf6f..a2ac959a1 100644 --- a/src/content/mod_configuration.cpp +++ b/src/content/mod_configuration.cpp @@ -21,16 +21,27 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #include "settings.h" #include "filesys.h" +#include "gettext.h" -void ModConfiguration::printUnsatisfiedModsError() const + +std::string ModConfiguration::getUnsatisfiedModsError() const { + std::ostringstream error; + error << gettext("Some mods have unsatisfied dependencies:") << std::endl; + for (const ModSpec &mod : m_unsatisfied_mods) { - errorstream << "mod \"" << mod.name - << "\" has unsatisfied dependencies: "; + //~ Error when a mod is missing dependencies. Ex: "Mod Title is missing: mod1, mod2, mod3" + error << " - " << fmtgettext("%s is missing:", mod.name.c_str()); for (const std::string &unsatisfied_depend : mod.unsatisfied_depends) - errorstream << " \"" << unsatisfied_depend << "\""; - errorstream << std::endl; + error << " " << unsatisfied_depend; + error << "\n"; } + + error << "\n" + << gettext("Install and enable the required mods, or disable the mods causing errors.") << "\n" + << gettext("Note: this may be caused by a dependency cycle, in which case try updating the mods."); + + return error.str(); } void ModConfiguration::addModsInPath(const std::string &path, const std::string &virtual_path) |