mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add "MINETEST_MOD_PATH" environment variable (#11515)
This adds an environment variable MINETEST_MOD_PATH. When it exists, Minetest will look there for mods in addition to ~/.minetest/mods/.
This commit is contained in:
parent
53e126ac49
commit
9fab5d594c
12 changed files with 74 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue