summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/externs.h1
-rw-r--r--src/init2.cc36
-rw-r--r--src/main.c37
3 files changed, 38 insertions, 36 deletions
diff --git a/src/externs.h b/src/externs.h
index 116e4e28..8cacb073 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -913,6 +913,7 @@ extern void reinit_quests(s16b new_size);
extern void create_stores_stock(int t);
extern errr init_v_info(void);
extern void init_file_paths(char *path);
+extern void init_file_paths_with_env();
extern void init_angband(void);
extern errr init_buildings(void);
extern s16b error_idx;
diff --git a/src/init2.cc b/src/init2.cc
index 725e87ba..a32a57f4 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -192,6 +192,42 @@ void init_file_paths(char *path)
}
+
+/*
+ * Initialize and verify the file paths, and the score file.
+ *
+ * Use the ANGBAND_PATH environment var if possible, else use
+ * DEFAULT_PATH, and in either case, branch off appropriately.
+ *
+ * First, we'll look for the ANGBAND_PATH environment variable,
+ * and then look for the files in there. If that doesn't work,
+ * we'll try the DEFAULT_PATH constant. So be sure that one of
+ * these two things works...
+ *
+ * We must ensure that the path ends with "PATH_SEP" if needed,
+ * since the "init_file_paths()" function will simply append the
+ * relevant "sub-directory names" to the given path.
+ */
+void init_file_paths_with_env()
+{
+ char path[1024];
+
+ cptr tail;
+
+ /* Get the environment variable */
+ tail = getenv("TOME_PATH");
+
+ /* Use the angband_path, or a default */
+ strcpy(path, tail ? tail : DEFAULT_PATH);
+
+ /* Hack -- Add a path separator (only if needed) */
+ if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP);
+
+ /* Initialize */
+ init_file_paths(path);
+}
+
+
/*
* Hack -- help give useful error messages
*/
diff --git a/src/main.c b/src/main.c
index 9ee3db4d..0e6a5907 100644
--- a/src/main.c
+++ b/src/main.c
@@ -105,41 +105,6 @@ static bool_ check_create_user_dir(void)
}
-/*
- * Initialize and verify the file paths, and the score file.
- *
- * Use the ANGBAND_PATH environment var if possible, else use
- * DEFAULT_PATH, and in either case, branch off appropriately.
- *
- * First, we'll look for the ANGBAND_PATH environment variable,
- * and then look for the files in there. If that doesn't work,
- * we'll try the DEFAULT_PATH constant. So be sure that one of
- * these two things works...
- *
- * We must ensure that the path ends with "PATH_SEP" if needed,
- * since the "init_file_paths()" function will simply append the
- * relevant "sub-directory names" to the given path.
- */
-static void init_stuff(void)
-{
- char path[1024];
-
- cptr tail;
-
- /* Get the environment variable */
- tail = getenv("TOME_PATH");
-
- /* Use the angband_path, or a default */
- strcpy(path, tail ? tail : DEFAULT_PATH);
-
- /* Hack -- Add a path separator (only if needed) */
- if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP);
-
- /* Initialize */
- init_file_paths(path);
-}
-
-
/*
* Handle a "-d<what>=<path>" option
@@ -257,7 +222,7 @@ int main(int argc, char *argv[])
/* Get the file paths */
- init_stuff();
+ init_file_paths_with_env();
/* Get the user id (?) */