From 9fab5d594cab4c0a027f0aecf356382f3a37c1de Mon Sep 17 00:00:00 2001
From: emixa-d <85313564+emixa-d@users.noreply.github.com>
Date: Wed, 6 Oct 2021 22:19:41 +0000
Subject: 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/.
---
 builtin/mainmenu/pkgmgr.lua | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'builtin/mainmenu')

diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 787936e31..76d4a4123 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -682,11 +682,9 @@ function pkgmgr.preparemodlist(data)
 	local game_mods = {}
 
 	--read global mods
-	local modpath = core.get_modpath()
-
-	if modpath ~= nil and
-		modpath ~= "" then
-		get_mods(modpath,global_mods)
+	local modpaths = core.get_modpaths()
+	for _, modpath in ipairs(modpaths) do
+		get_mods(modpath, global_mods)
 	end
 
 	for i=1,#global_mods,1 do
-- 
cgit v1.2.3