dnl generate the installation path for the ./lib/ folder
if test "$GAMEGROUP" != ""; then
- MY_EXPAND_DIR(game_datadir, "$datadir/games/$PACKAGE/lib/")
+ MY_EXPAND_DIR(game_libpath, "$datadir/games/$PACKAGE/lib/")
else
- MY_EXPAND_DIR(game_datadir, "./lib/")
+ MY_EXPAND_DIR(game_libpath, "./lib/")
bindir=".."
fi
dnl overwrite the path with an user-specified value
AC_ARG_WITH(libpath,
[ --with-libpath=path specify the path to the Hengband lib folder],
-[game_datadir="$withval"])
+[game_libpath="$withval"])
-AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$game_datadir", [Path to the Hengband lib folder])
-DEFAULT_PATH="$game_datadir"
-AC_SUBST(DEFAULT_PATH)
+AC_ARG_WITH(varpath,
+[ --with-varpath=path specify the path to the Hengband var folder],
+[game_varpath="$withval"],
+[game_varpath="$game_libpath"])
+
+AC_DEFINE_UNQUOTED(DEFAULT_LIB_PATH, "$game_libpath", [Path to the Hengband lib folder])
+DEFAULT_LIB_PATH="$game_libpath"
+AC_SUBST(DEFAULT_LIB_PATH)
+
+AC_DEFINE_UNQUOTED(DEFAULT_VAR_PATH, "$game_varpath", [Path to the Hengband var folder])
+DEFAULT_VAR_PATH="$game_varpath"
+AC_SUBST(DEFAULT_VAR_PATH)
dnl Checks for programs.
AC_PROG_CC
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@apex
+angbanddir = @DEFAULT_VAR_PATH@/apex
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@bone
+angbanddir = @DEFAULT_VAR_PATH@/bone
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@data
+angbanddir = @DEFAULT_VAR_PATH@/data
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@edit
+angbanddir = @DEFAULT_LIB_PATH@/edit
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@file
+angbanddir = @DEFAULT_LIB_PATH@/file
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@help
+angbanddir = @DEFAULT_LIB_PATH@/help
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@info
+angbanddir = @DEFAULT_LIB_PATH@/info
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@pref
+angbanddir = @DEFAULT_LIB_PATH@/pref
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@save
+angbanddir = @DEFAULT_VAR_PATH@/save
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@script
+angbanddir = @DEFAULT_LIB_PATH@/script
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@user
+angbanddir = @DEFAULT_VAR_PATH@/user
angband_DATA = \
$(angband_files)
$(angband_files)
if SET_GID
-angbanddir = @DEFAULT_PATH@xtra/graf
+angbanddir = @DEFAULT_LIB_PATH@/xtra/graf
angband_DATA = \
$(angband_files)
extern errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax);
/* init2.c */
-extern void init_file_paths(char *path);
+extern void init_file_paths(char *libpath, char *varpath);
extern cptr err_str[PARSE_ERROR_MAX];
extern errr init_v_info(void);
extern errr init_buildings(void);
* this function to be called multiple times, for example, to
* try several base "path" values until a good one is found.
*/
-void init_file_paths(char *path)
+void init_file_paths(char *libpath, char *varpath)
{
- char *tail;
+ char *libtail, *vartail;
#ifdef PRIVATE_USER_PATH
char buf[1024];
/*** Prepare the "path" ***/
/* Hack -- save the main directory */
- ANGBAND_DIR = string_make(path);
-
- /* Prepare to append to the Base Path */
- tail = path + strlen(path);
+ ANGBAND_DIR = string_make(libpath);
+ /* Prepare to append to the Base Paths */
+ libtail = libpath + strlen(libpath);
+ vartail = varpath + strlen(varpath);
#ifdef VM
/*** Build the sub-directory names ***/
/* Build a path name */
- strcpy(tail, "apex");
- ANGBAND_DIR_APEX = string_make(path);
+ strcpy(vartail, "apex");
+ ANGBAND_DIR_APEX = string_make(varpath);
/* Build a path name */
- strcpy(tail, "bone");
- ANGBAND_DIR_BONE = string_make(path);
+ strcpy(vartail, "bone");
+ ANGBAND_DIR_BONE = string_make(varpath);
/* Build a path name */
- strcpy(tail, "data");
- ANGBAND_DIR_DATA = string_make(path);
+ strcpy(vartail, "data");
+ ANGBAND_DIR_DATA = string_make(varpath);
/* Build a path name */
- strcpy(tail, "edit");
- ANGBAND_DIR_EDIT = string_make(path);
+ strcpy(libtail, "edit");
+ ANGBAND_DIR_EDIT = string_make(libpath);
/* Build a path name */
- strcpy(tail, "script");
- ANGBAND_DIR_SCRIPT = string_make(path);
+ strcpy(libtail, "script");
+ ANGBAND_DIR_SCRIPT = string_make(libpath);
/* Build a path name */
- strcpy(tail, "file");
- ANGBAND_DIR_FILE = string_make(path);
+ strcpy(libtail, "file");
+ ANGBAND_DIR_FILE = string_make(libpath);
/* Build a path name */
- strcpy(tail, "help");
- ANGBAND_DIR_HELP = string_make(path);
+ strcpy(libtail, "help");
+ ANGBAND_DIR_HELP = string_make(libpath);
/* Build a path name */
- strcpy(tail, "info");
- ANGBAND_DIR_INFO = string_make(path);
+ strcpy(libtail, "info");
+ ANGBAND_DIR_INFO = string_make(libpath);
/* Build a path name */
- strcpy(tail, "pref");
- ANGBAND_DIR_PREF = string_make(path);
+ strcpy(libtail, "pref");
+ ANGBAND_DIR_PREF = string_make(libpath);
/* Build a path name */
- strcpy(tail, "save");
- ANGBAND_DIR_SAVE = string_make(path);
+ strcpy(vartail, "save");
+ ANGBAND_DIR_SAVE = string_make(varpath);
#ifdef PRIVATE_USER_PATH
#else /* PRIVATE_USER_PATH */
/* Build a path name */
- strcpy(tail, "user");
- ANGBAND_DIR_USER = string_make(path);
+ strcpy(vartail, "user");
+ ANGBAND_DIR_USER = string_make(varpath);
#endif /* PRIVATE_USER_PATH */
/* Build a path name */
- strcpy(tail, "xtra");
- ANGBAND_DIR_XTRA = string_make(path);
+ strcpy(libtail, "xtra");
+ ANGBAND_DIR_XTRA = string_make(libpath);
#endif /* VM */
string_free(ANGBAND_DIR_DATA);
/* Build a new path name */
- sprintf(tail, "data-%s", next);
- ANGBAND_DIR_DATA = string_make(path);
+ sprintf(vartail, "data-%s", next);
+ ANGBAND_DIR_DATA = string_make(varpath);
}
}
while (1)
{
/* Prepare the paths */
- init_file_paths(path);
+ init_file_paths(path, path);
/* Build the filename */
#ifdef JP
validate_dir(path, TRUE);
/* Init the file paths */
- init_file_paths(path);
+ init_file_paths(path, path);
/* Hack -- Validate the paths */
validate_dir(ANGBAND_DIR_APEX, FALSE);
* 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.
+ * DEFAULT_(LIB|VAR)_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'll try the DEFAULT_(LIB|VAR)_PATH constants. 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
*/
static void init_stuff(void)
{
- char path[1024];
+ char libpath[1024], varpath[1024];
#if defined(AMIGA) || defined(VM)
tail = getenv("ANGBAND_PATH");
/* Use the angband_path, or a default */
- strncpy(path, tail ? tail : DEFAULT_PATH, 511);
+ strncpy(libpath, tail ? tail : DEFAULT_LIB_PATH, 511);
+ strncpy(varpath, tail ? tail : DEFAULT_VAR_PATH, 511);
- /* Make sure it's terminated */
- path[511] = '\0';
+ /* Make sure they're terminated */
+ libpath[511] = '\0';
+ varpath[511] = '\0';
/* Hack -- Add a path separator (only if needed) */
- if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP);
+ if (!suffix(libpath, PATH_SEP)) strcat(libpath, PATH_SEP);
+ if (!suffix(varpath, PATH_SEP)) strcat(varpath, PATH_SEP);
#endif /* AMIGA / VM */
/* Initialize */
- init_file_paths(path);
+ init_file_paths(libpath, varpath);
}
* actual location of the "lib" folder, for example, "/tmp/angband/lib/"
* or "/usr/games/lib/angband/", or "/pkg/angband/lib".
*/
-#ifndef DEFAULT_PATH
-# define DEFAULT_PATH "./lib/"
+#ifndef DEFAULT_LIB_PATH
+# define DEFAULT_LIB_PATH "./lib/"
+#endif
+
+
+/*
+ * OPTION: Set the "default" path to the angband "var" directory.
+ *
+ * This is like DEFAULT_LIB_PATH, but is for files that will be
+ * modified after installation.
+ */
+#ifndef DEFAULT_VAR_PATH
+# define DEFAULT_VAR_PATH DEFAULT_LIB_PATH
#endif