summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/luanti-paths.patch
blob: 0e2ee51e89c9dc35bce94855afb0c648d8fe1c15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Index: luanti/src/content/subgames.cpp
===================================================================
--- luanti.orig/src/content/subgames.cpp
+++ luanti/src/content/subgames.cpp
@@ -63,19 +63,21 @@ struct GameFindPath
 std::string getSubgamePathEnv()
 {
 	static bool has_warned = false;
-	char *subgame_path = getenv("MINETEST_SUBGAME_PATH");
-	if (subgame_path && !has_warned) {
-		warningstream << "MINETEST_SUBGAME_PATH is deprecated, use MINETEST_GAME_PATH instead."
+
+	if (char *luanti_game_path = getenv ("LUANTI_GAME_PATH"))
+		return std::string(luanti_game_path);
+	else if (char *minetest_game_path = getenv ("MINETEST_GAME_PATH")) {
+		warningstream << "MINETEST_GAME_PATH is deprecated, use LUANTI_GAME_PATH instead."
 				<< std::endl;
 		has_warned = true;
+		return std::string(minetest_game_path);
+	}
+	else if (char *minetest_subgame_path = getenv ("MINETEST_SUBGAME_PATH")) {
+		warningstream << "MINETEST_SUBGAME_PATH is deprecated, use LUANTI_GAME_PATH instead."
+				<< std::endl;
+		has_warned = true;
+		return std::string(minetest_subgame_path);
 	}
-
-	char *game_path = getenv("MINETEST_GAME_PATH");
-
-	if (game_path)
-		return std::string(game_path);
-	else if (subgame_path)
-		return std::string(subgame_path);
 	return "";
 }
 
@@ -277,8 +279,17 @@ std::string getWorldGameId(const std::st
 
 std::string getWorldPathEnv()
 {
-	char *world_path = getenv("MINETEST_WORLD_PATH");
-	return world_path ? std::string(world_path) : "";
+	static bool has_warned = false;
+	char *world_path = nullptr;
+	if (world_path = getenv("LUANTI_WORLD_PATH"))
+		return std::string(world_path);
+	else if (world_path = getenv("MINETEST_WORLD_PATH")) {
+		warningstream << "MINETEST_WORLD_PATH is deprecated, use LUANTI_WORLD_PATH instead."
+				<< std::endl;
+		return std::string(world_path);
+	}
+	else
+		return "";
 }
 
 std::vector<WorldSpec> getAvailableWorlds()
@@ -411,8 +422,18 @@ void loadGameConfAndInitWorld(const std:
 
 std::vector<std::string> getEnvModPaths()
 {
-	const char *c_mod_path = getenv("MINETEST_MOD_PATH");
+	static bool has_warned = false;
 	std::vector<std::string> paths;
+	if (const char *c_mod_path = getenv("MINETEST_MOD_PATH")) {
+		warningstream << "MINETEST_MOD_PATH is deprecated, use LUANTI_MOD_PATH instead."
+			      << std::endl;
+		has_warned = true;
+		Strfnd search_paths(c_mod_path ? c_mod_path : "");
+		while (!search_paths.at_end())
+			paths.push_back(search_paths.next(PATH_DELIM));
+
+	}
+	const char *c_mod_path = getenv("LUANTI_MOD_PATH");
 	Strfnd search_paths(c_mod_path ? c_mod_path : "");
 	while (!search_paths.at_end())
 		paths.push_back(search_paths.next(PATH_DELIM));