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
| | From 80a1054060006e9e6c3f87d8c0826b1f620789f1 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sat, 6 Sep 2014 13:21:46 -0400
Subject: [PATCH] Search for subgames using $MINETEST_SUBGAME_PATH.
---
src/subgame.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/subgame.cpp b/src/subgame.cpp
index f2465c9..24a4af5 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -66,6 +66,19 @@ SubgameSpec findSubgame(const std::string &id)
std::string share = porting::path_share;
std::string user = porting::path_user;
std::vector<GameFindPath> find_paths;
+
+ char *search_paths = getenv("MINETEST_SUBGAME_PATH");
+ char *search_path = strtok(search_paths, ":");
+
+ while(search_path != NULL) {
+ std::string path = std::string(search_path);
+ find_paths.push_back(GameFindPath(
+ path + DIR_DELIM + id, false));
+ find_paths.push_back(GameFindPath(
+ path + DIR_DELIM + id + "_game", false));
+ search_path = strtok(NULL, ":");
+ }
+
find_paths.push_back(GameFindPath(
user + DIR_DELIM + "games" + DIR_DELIM + id + "_game", true));
find_paths.push_back(GameFindPath(
@@ -129,6 +142,15 @@ std::set<std::string> getAvailableGameIds()
std::set<std::string> gamespaths;
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
gamespaths.insert(porting::path_user + DIR_DELIM + "games");
+
+ char *search_paths = getenv("MINETEST_SUBGAME_PATH");
+ char *search_path = strtok(search_paths, ":");
+
+ while(search_path != NULL) {
+ gamespaths.insert(std::string(search_path));
+ search_path = strtok(NULL, ":");
+ }
+
for(std::set<std::string>::const_iterator i = gamespaths.begin();
i != gamespaths.end(); i++){
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(*i);
--
2.1.0
|