1
0
mirror of https://github.com/minetest/minetest.git synced 2024-12-29 20:20:29 +01:00

Fix mods folder being read twice with RUN_IN_PLACE=1 (#15024)

This commit is contained in:
grorp 2024-08-21 20:25:58 +02:00 committed by GitHub
parent b2f6a65bc9
commit 66b3db3601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -282,7 +282,7 @@ Package - content which is downloadable from the content db, may or may not be i
```lua
{
mods = "/home/user/.minetest/mods",
share = "/usr/share/minetest/mods",
share = "/usr/share/minetest/mods", -- only provided when RUN_IN_PLACE=0
-- Custom dirs can be specified by the MINETEST_MOD_DIR env variable
["/path/to/custom/dir"] = "/path/to/custom/dir",

View File

@ -675,10 +675,12 @@ int ModApiMainMenu::l_get_modpaths(lua_State *L)
ModApiMainMenu::l_get_modpath(L);
lua_setfield(L, -2, "mods");
std::string modpath = fs::RemoveRelativePathComponents(
porting::path_share + DIR_DELIM + "mods" + DIR_DELIM);
lua_pushstring(L, modpath.c_str());
lua_setfield(L, -2, "share");
if (porting::path_share != porting::path_user) {
std::string modpath = fs::RemoveRelativePathComponents(
porting::path_share + DIR_DELIM + "mods" + DIR_DELIM);
lua_pushstring(L, modpath.c_str());
lua_setfield(L, -2, "share");
}
for (const std::string &component : getEnvModPaths()) {
lua_pushstring(L, component.c_str());