変愚蛮怒のメインリポジトリです
Revision | b6b861d781dd5738cd7d9617ff77e99bfdbf048c (tree) |
---|---|
Time | 2020-02-16 22:04:35 |
Author | deskull <deskull@user...> |
Commiter | deskull |
Merge pull request #40011 (phonohawk/hengband/with-varpath into master).
@@ -19,20 +19,29 @@ AC_LANG_C | ||
19 | 19 | |
20 | 20 | dnl generate the installation path for the ./lib/ folder |
21 | 21 | if test "$GAMEGROUP" != ""; then |
22 | - MY_EXPAND_DIR(game_datadir, "$datadir/games/$PACKAGE/lib/") | |
22 | + MY_EXPAND_DIR(game_libpath, "$datadir/games/$PACKAGE/lib/") | |
23 | 23 | else |
24 | - MY_EXPAND_DIR(game_datadir, "./lib/") | |
24 | + MY_EXPAND_DIR(game_libpath, "./lib/") | |
25 | 25 | bindir=".." |
26 | 26 | fi |
27 | 27 | |
28 | 28 | dnl overwrite the path with an user-specified value |
29 | 29 | AC_ARG_WITH(libpath, |
30 | 30 | [ --with-libpath=path specify the path to the Hengband lib folder], |
31 | -[game_datadir="$withval"]) | |
31 | +[game_libpath="$withval"]) | |
32 | 32 | |
33 | -AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$game_datadir", [Path to the Hengband lib folder]) | |
34 | -DEFAULT_PATH="$game_datadir" | |
35 | -AC_SUBST(DEFAULT_PATH) | |
33 | +AC_ARG_WITH(varpath, | |
34 | +[ --with-varpath=path specify the path to the Hengband var folder], | |
35 | +[game_varpath="$withval"], | |
36 | +[game_varpath="$game_libpath"]) | |
37 | + | |
38 | +AC_DEFINE_UNQUOTED(DEFAULT_LIB_PATH, "$game_libpath", [Path to the Hengband lib folder]) | |
39 | +DEFAULT_LIB_PATH="$game_libpath" | |
40 | +AC_SUBST(DEFAULT_LIB_PATH) | |
41 | + | |
42 | +AC_DEFINE_UNQUOTED(DEFAULT_VAR_PATH, "$game_varpath", [Path to the Hengband var folder]) | |
43 | +DEFAULT_VAR_PATH="$game_varpath" | |
44 | +AC_SUBST(DEFAULT_VAR_PATH) | |
36 | 45 | |
37 | 46 | dnl Checks for programs. |
38 | 47 | AC_PROG_CC |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@apex | |
10 | +angbanddir = @DEFAULT_VAR_PATH@/apex | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@bone | |
10 | +angbanddir = @DEFAULT_VAR_PATH@/bone | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@data | |
10 | +angbanddir = @DEFAULT_VAR_PATH@/data | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -22,7 +22,7 @@ EXTRA_DIST = \ | ||
22 | 22 | $(angband_files) |
23 | 23 | |
24 | 24 | if SET_GID |
25 | -angbanddir = @DEFAULT_PATH@edit | |
25 | +angbanddir = @DEFAULT_LIB_PATH@/edit | |
26 | 26 | |
27 | 27 | angband_DATA = \ |
28 | 28 | $(angband_files) |
@@ -20,7 +20,7 @@ EXTRA_DIST = \ | ||
20 | 20 | $(angband_files) |
21 | 21 | |
22 | 22 | if SET_GID |
23 | -angbanddir = @DEFAULT_PATH@file | |
23 | +angbanddir = @DEFAULT_LIB_PATH@/file | |
24 | 24 | |
25 | 25 | angband_DATA = \ |
26 | 26 | $(angband_files) |
@@ -26,7 +26,7 @@ EXTRA_DIST = \ | ||
26 | 26 | $(angband_files) |
27 | 27 | |
28 | 28 | if SET_GID |
29 | -angbanddir = @DEFAULT_PATH@help | |
29 | +angbanddir = @DEFAULT_LIB_PATH@/help | |
30 | 30 | |
31 | 31 | angband_DATA = \ |
32 | 32 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@info | |
10 | +angbanddir = @DEFAULT_LIB_PATH@/info | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -18,7 +18,7 @@ EXTRA_DIST = \ | ||
18 | 18 | $(angband_files) |
19 | 19 | |
20 | 20 | if SET_GID |
21 | -angbanddir = @DEFAULT_PATH@pref | |
21 | +angbanddir = @DEFAULT_LIB_PATH@/pref | |
22 | 22 | |
23 | 23 | angband_DATA = \ |
24 | 24 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@save | |
10 | +angbanddir = @DEFAULT_VAR_PATH@/save | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@script | |
10 | +angbanddir = @DEFAULT_LIB_PATH@/script | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@user | |
10 | +angbanddir = @DEFAULT_VAR_PATH@/user | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -7,7 +7,7 @@ EXTRA_DIST = \ | ||
7 | 7 | $(angband_files) |
8 | 8 | |
9 | 9 | if SET_GID |
10 | -angbanddir = @DEFAULT_PATH@xtra/graf | |
10 | +angbanddir = @DEFAULT_LIB_PATH@/xtra/graf | |
11 | 11 | |
12 | 12 | angband_DATA = \ |
13 | 13 | $(angband_files) |
@@ -618,7 +618,7 @@ extern s16b f_tag_to_index(concptr str); | ||
618 | 618 | extern errr process_dungeon_file(concptr name, int ymin, int xmin, int ymax, int xmax); |
619 | 619 | |
620 | 620 | /* init2.c */ |
621 | -extern void init_file_paths(char *path); | |
621 | +extern void init_file_paths(char *libpath, char *varpath); | |
622 | 622 | extern concptr err_str[PARSE_ERROR_MAX]; |
623 | 623 | extern errr init_v_info(void); |
624 | 624 | extern errr init_buildings(void); |
@@ -81,9 +81,9 @@ static void put_title(void); | ||
81 | 81 | * try several base "path" values until a good one is found. |
82 | 82 | * </pre> |
83 | 83 | */ |
84 | -void init_file_paths(char *path) | |
84 | +void init_file_paths(char *libpath, char *varpath) | |
85 | 85 | { |
86 | - char *tail; | |
86 | + char *libtail, *vartail; | |
87 | 87 | |
88 | 88 | #ifdef PRIVATE_USER_PATH |
89 | 89 | char buf[1024]; |
@@ -111,52 +111,53 @@ void init_file_paths(char *path) | ||
111 | 111 | /*** Prepare the "path" ***/ |
112 | 112 | |
113 | 113 | /* Hack -- save the main directory */ |
114 | - ANGBAND_DIR = string_make(path); | |
114 | + ANGBAND_DIR = string_make(libpath); | |
115 | 115 | |
116 | - /* Prepare to append to the Base Path */ | |
117 | - tail = path + strlen(path); | |
116 | + /* Prepare to append to the Base Paths */ | |
117 | + libtail = libpath + strlen(libpath); | |
118 | + vartail = varpath + strlen(varpath); | |
118 | 119 | |
119 | 120 | /*** Build the sub-directory names ***/ |
120 | 121 | |
121 | 122 | /* Build a path name */ |
122 | - strcpy(tail, "apex"); | |
123 | - ANGBAND_DIR_APEX = string_make(path); | |
123 | + strcpy(vartail, "apex"); | |
124 | + ANGBAND_DIR_APEX = string_make(varpath); | |
124 | 125 | |
125 | 126 | /* Build a path name */ |
126 | - strcpy(tail, "bone"); | |
127 | - ANGBAND_DIR_BONE = string_make(path); | |
127 | + strcpy(vartail, "bone"); | |
128 | + ANGBAND_DIR_BONE = string_make(varpath); | |
128 | 129 | |
129 | 130 | /* Build a path name */ |
130 | - strcpy(tail, "data"); | |
131 | - ANGBAND_DIR_DATA = string_make(path); | |
131 | + strcpy(vartail, "data"); | |
132 | + ANGBAND_DIR_DATA = string_make(varpath); | |
132 | 133 | |
133 | 134 | /* Build a path name */ |
134 | - strcpy(tail, "edit"); | |
135 | - ANGBAND_DIR_EDIT = string_make(path); | |
135 | + strcpy(libtail, "edit"); | |
136 | + ANGBAND_DIR_EDIT = string_make(libpath); | |
136 | 137 | |
137 | 138 | /* Build a path name */ |
138 | - strcpy(tail, "script"); | |
139 | - ANGBAND_DIR_SCRIPT = string_make(path); | |
139 | + strcpy(libtail, "script"); | |
140 | + ANGBAND_DIR_SCRIPT = string_make(libpath); | |
140 | 141 | |
141 | 142 | /* Build a path name */ |
142 | - strcpy(tail, "file"); | |
143 | - ANGBAND_DIR_FILE = string_make(path); | |
143 | + strcpy(libtail, "file"); | |
144 | + ANGBAND_DIR_FILE = string_make(libpath); | |
144 | 145 | |
145 | 146 | /* Build a path name */ |
146 | - strcpy(tail, "help"); | |
147 | - ANGBAND_DIR_HELP = string_make(path); | |
147 | + strcpy(libtail, "help"); | |
148 | + ANGBAND_DIR_HELP = string_make(libpath); | |
148 | 149 | |
149 | 150 | /* Build a path name */ |
150 | - strcpy(tail, "info"); | |
151 | - ANGBAND_DIR_INFO = string_make(path); | |
151 | + strcpy(libtail, "info"); | |
152 | + ANGBAND_DIR_INFO = string_make(libpath); | |
152 | 153 | |
153 | 154 | /* Build a path name */ |
154 | - strcpy(tail, "pref"); | |
155 | - ANGBAND_DIR_PREF = string_make(path); | |
155 | + strcpy(libtail, "pref"); | |
156 | + ANGBAND_DIR_PREF = string_make(libpath); | |
156 | 157 | |
157 | 158 | /* Build a path name */ |
158 | - strcpy(tail, "save"); | |
159 | - ANGBAND_DIR_SAVE = string_make(path); | |
159 | + strcpy(vartail, "save"); | |
160 | + ANGBAND_DIR_SAVE = string_make(varpath); | |
160 | 161 | |
161 | 162 | #ifdef PRIVATE_USER_PATH |
162 | 163 |
@@ -169,14 +170,14 @@ void init_file_paths(char *path) | ||
169 | 170 | #else /* PRIVATE_USER_PATH */ |
170 | 171 | |
171 | 172 | /* Build a path name */ |
172 | - strcpy(tail, "user"); | |
173 | - ANGBAND_DIR_USER = string_make(path); | |
173 | + strcpy(vartail, "user"); | |
174 | + ANGBAND_DIR_USER = string_make(varpath); | |
174 | 175 | |
175 | 176 | #endif /* PRIVATE_USER_PATH */ |
176 | 177 | |
177 | 178 | /* Build a path name */ |
178 | - strcpy(tail, "xtra"); | |
179 | - ANGBAND_DIR_XTRA = string_make(path); | |
179 | + strcpy(libtail, "xtra"); | |
180 | + ANGBAND_DIR_XTRA = string_make(libpath); | |
180 | 181 | |
181 | 182 | |
182 | 183 | #ifdef NeXT |
@@ -209,8 +210,8 @@ void init_file_paths(char *path) | ||
209 | 210 | string_free(ANGBAND_DIR_DATA); |
210 | 211 | |
211 | 212 | /* Build a new path name */ |
212 | - sprintf(tail, "data-%s", next); | |
213 | - ANGBAND_DIR_DATA = string_make(path); | |
213 | + sprintf(vartail, "data-%s", next); | |
214 | + ANGBAND_DIR_DATA = string_make(varpath); | |
214 | 215 | } |
215 | 216 | } |
216 | 217 |
@@ -7016,7 +7016,7 @@ static void init_stuff(void) | ||
7016 | 7016 | while (1) |
7017 | 7017 | { |
7018 | 7018 | /* Prepare the paths */ |
7019 | - init_file_paths(path); | |
7019 | + init_file_paths(path, path); | |
7020 | 7020 | |
7021 | 7021 | /* Build the filename */ |
7022 | 7022 | path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); |
@@ -5440,7 +5440,7 @@ static void init_stuff(void) | ||
5440 | 5440 | validate_dir(path, TRUE); |
5441 | 5441 | |
5442 | 5442 | /* Init the file paths */ |
5443 | - init_file_paths(path); | |
5443 | + init_file_paths(path, path); | |
5444 | 5444 | |
5445 | 5445 | /* Hack -- Validate the paths */ |
5446 | 5446 | validate_dir(ANGBAND_DIR_APEX, FALSE); |
@@ -80,12 +80,13 @@ static void create_user_dir(void) | ||
80 | 80 | * Initialize and verify the file paths, and the score file. |
81 | 81 | * |
82 | 82 | * Use the ANGBAND_PATH environment var if possible, else use |
83 | - * DEFAULT_PATH, and in either case, branch off appropriately. | |
83 | + * DEFAULT_(LIB|VAR)_PATH, and in either case, branch off | |
84 | + * appropriately. | |
84 | 85 | * |
85 | 86 | * First, we'll look for the ANGBAND_PATH environment variable, |
86 | 87 | * and then look for the files in there. If that doesn't work, |
87 | - * we'll try the DEFAULT_PATH constant. So be sure that one of | |
88 | - * these two things works... | |
88 | + * we'll try the DEFAULT_(LIB|VAR)_PATH constants. So be sure | |
89 | + * that one of these two things works... | |
89 | 90 | * |
90 | 91 | * We must ensure that the path ends with "PATH_SEP" if needed, |
91 | 92 | * since the "init_file_paths()" function will simply append the |
@@ -97,7 +98,7 @@ static void create_user_dir(void) | ||
97 | 98 | */ |
98 | 99 | static void init_stuff(void) |
99 | 100 | { |
100 | - char path[1024]; | |
101 | + char libpath[1024], varpath[1024]; | |
101 | 102 | |
102 | 103 | concptr tail; |
103 | 104 |
@@ -105,16 +106,19 @@ static void init_stuff(void) | ||
105 | 106 | tail = getenv("ANGBAND_PATH"); |
106 | 107 | |
107 | 108 | /* Use the angband_path, or a default */ |
108 | - strncpy(path, tail ? tail : DEFAULT_PATH, 511); | |
109 | + strncpy(libpath, tail ? tail : DEFAULT_LIB_PATH, 511); | |
110 | + strncpy(varpath, tail ? tail : DEFAULT_VAR_PATH, 511); | |
109 | 111 | |
110 | - /* Make sure it's terminated */ | |
111 | - path[511] = '\0'; | |
112 | + /* Make sure they're terminated */ | |
113 | + libpath[511] = '\0'; | |
114 | + varpath[511] = '\0'; | |
112 | 115 | |
113 | 116 | /* Hack -- Add a path separator (only if needed) */ |
114 | - if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP); | |
117 | + if (!suffix(libpath, PATH_SEP)) strcat(libpath, PATH_SEP); | |
118 | + if (!suffix(varpath, PATH_SEP)) strcat(varpath, PATH_SEP); | |
115 | 119 | |
116 | 120 | /* Initialize */ |
117 | - init_file_paths(path); | |
121 | + init_file_paths(libpath, varpath); | |
118 | 122 | } |
119 | 123 | |
120 | 124 |
@@ -308,8 +308,19 @@ | ||
308 | 308 | * actual location of the "lib" folder, for example, "/tmp/angband/lib/" |
309 | 309 | * or "/usr/games/lib/angband/", or "/pkg/angband/lib". |
310 | 310 | */ |
311 | -#ifndef DEFAULT_PATH | |
312 | -# define DEFAULT_PATH "./lib/" | |
311 | +#ifndef DEFAULT_LIB_PATH | |
312 | +# define DEFAULT_LIB_PATH "./lib/" | |
313 | +#endif | |
314 | + | |
315 | + | |
316 | +/* | |
317 | + * OPTION: Set the "default" path to the angband "var" directory. | |
318 | + * | |
319 | + * This is like DEFAULT_LIB_PATH, but is for files that will be | |
320 | + * modified after installation. | |
321 | + */ | |
322 | +#ifndef DEFAULT_VAR_PATH | |
323 | +# define DEFAULT_VAR_PATH DEFAULT_LIB_PATH | |
313 | 324 | #endif |
314 | 325 | |
315 | 326 |