aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/subgames.cpp14
-rw-r--r--src/content/subgames.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp
index e9dc609b0..30447c838 100644
--- a/src/content/subgames.cpp
+++ b/src/content/subgames.cpp
@@ -113,6 +113,10 @@ SubgameSpec findSubgame(const std::string &id)
if (user != share || user_game)
mods_paths.insert(user + DIR_DELIM + "mods");
+ for (const std::string &mod_path : getEnvModPaths()) {
+ mods_paths.insert(mod_path);
+ }
+
// Get meta
std::string conf_path = game_path + DIR_DELIM + "game.conf";
Settings conf;
@@ -384,3 +388,13 @@ void loadGameConfAndInitWorld(const std::string &path, const std::string &name,
if (new_game_settings)
delete game_settings;
}
+
+std::vector<std::string> getEnvModPaths()
+{
+ const char *c_mod_path = getenv("MINETEST_MOD_PATH");
+ std::vector<std::string> paths;
+ Strfnd search_paths(c_mod_path ? c_mod_path : "");
+ while (!search_paths.at_end())
+ paths.push_back(search_paths.next(PATH_DELIM));
+ return paths;
+}
diff --git a/src/content/subgames.h b/src/content/subgames.h
index 60392639b..4a50803e8 100644
--- a/src/content/subgames.h
+++ b/src/content/subgames.h
@@ -58,6 +58,8 @@ SubgameSpec findWorldSubgame(const std::string &world_path);
std::set<std::string> getAvailableGameIds();
std::vector<SubgameSpec> getAvailableGames();
+// Get the list of paths to mods in the environment variable $MINETEST_MOD_PATH
+std::vector<std::string> getEnvModPaths();
bool getWorldExists(const std::string &world_path);
//! Try to get the displayed name of a world