add command line option --showpaths
Add
--showpaths
early option to show where NetHack is expecting to find certain files
without starting up a game. It exits afterwards.
Windows sample (for illustration only, locations may differ for you):
Variable playground locations:
[hackdir ]="C:\Users\JohnDoe\NetHack\3.6\"
[leveldir ]="C:\Users\JohnDoe\AppData\Local\NetHack\3.6\"
[savedir ]="C:\Users\JohnDoe\AppData\Local\NetHack\3.6\"
[bonesdir ]="C:\ProgramData\NetHack\3.6\"
[datadir ]="C:\personal\nhdev\363\test\binary\"
[scoredir ]="C:\ProgramData\NetHack\3.6\"
[lockdir ]="C:\ProgramData\NetHack\3.6\"
[sysconfdir]="C:\ProgramData\NetHack\3.6\"
[configdir ]="C:\Users\JohnDoe\NetHack\3.6\"
[troubledir]="C:\Users\JohnDoe\NetHack\3.6\"
Your system configuration file (in sysconfdir):
"C:\Users\JohnDoe\NetHack\3.6\sysconf"
Your system symbols file (in sysconfdir):
"C:\Users\JohnDoe\NetHack\3.6\symbols"
Your personal configuration file (in configdir):
"C:\Users\JohnDoe\NetHack\3.6\.nethackrc"
Linux (for illustration only, locations may differ for you):
Your system configuration file:
"/home/johndoe/nh/install/games/lib/nethackdir/sysconf"
Your system symbols file:
"/home/johndoe/nh/install/games/lib/nethackdir/symbols"
Your personal configuration file:
"/home/johndoe/.nethackrc"
This commit is contained in:
@@ -767,6 +767,7 @@ const char *msg;
|
||||
static struct early_opt earlyopts[] = {
|
||||
{ARG_DEBUG, "debug", 5, TRUE},
|
||||
{ARG_VERSION, "version", 4, TRUE},
|
||||
{ARG_SHOWPATHS, "showpaths", 9, FALSE},
|
||||
#ifdef WIN32
|
||||
{ARG_WINDOWS, "windows", 4, TRUE},
|
||||
#endif
|
||||
@@ -845,6 +846,9 @@ enum earlyarg e_arg;
|
||||
early_version_info(insert_into_pastebuf);
|
||||
return 2;
|
||||
}
|
||||
case ARG_SHOWPATHS: {
|
||||
return 2;
|
||||
}
|
||||
#ifdef WIN32
|
||||
case ARG_WINDOWS: {
|
||||
if (extended_opt) {
|
||||
|
||||
100
src/files.c
100
src/files.c
@@ -3197,7 +3197,13 @@ fopen_sym_file()
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen_datafile(SYMBOLS, "r", HACKPREFIX);
|
||||
fp = fopen_datafile(SYMBOLS, "r",
|
||||
#ifdef WIN32
|
||||
SYSCONFPREFIX
|
||||
#else
|
||||
HACKPREFIX
|
||||
#endif
|
||||
);
|
||||
|
||||
return fp;
|
||||
}
|
||||
@@ -3966,6 +3972,98 @@ boolean wildcards;
|
||||
|
||||
#endif /*DEBUG*/
|
||||
|
||||
void
|
||||
reveal_paths(VOID_ARGS)
|
||||
{
|
||||
int i;
|
||||
#define PATHBUFSZ 1024
|
||||
char buf[PATHBUFSZ];
|
||||
#ifdef UNIX
|
||||
char *envp, *slash, nhpath[PATHBUFSZ];
|
||||
#endif
|
||||
|
||||
/* write out path details */
|
||||
#ifdef PREFIXES_IN_USE
|
||||
raw_print("Variable playground locations:");
|
||||
for (i = 0; i < PREFIX_COUNT; i++)
|
||||
raw_printf(" [%-10s]=\"%s\"", fqn_prefix_names[i],
|
||||
fqn_prefix[i]
|
||||
? fqn_prefix[i]
|
||||
: "not set");
|
||||
#endif
|
||||
/* sysconf file */
|
||||
#ifdef PREFIXES_IN_USE
|
||||
Sprintf(buf, " (in %s)",
|
||||
fqn_prefix_names[SYSCONFPREFIX]);
|
||||
#else
|
||||
buf[0] = '\0';
|
||||
#endif
|
||||
raw_printf("Your system configuration file%s:", buf);
|
||||
set_configfile_name(fqname(SYSCF_FILE, SYSCONFPREFIX, 0));
|
||||
raw_printf(" \"%s\"", configfile);
|
||||
#ifdef UNIX
|
||||
Strcpy(nhpath, configfile);
|
||||
slash = rindex(nhpath, '/');
|
||||
if (slash)
|
||||
*slash = '\0';
|
||||
#endif
|
||||
|
||||
/* symbols file */
|
||||
#ifdef PREFIXES_IN_USE
|
||||
Sprintf(buf, " (in %s)",
|
||||
#ifdef WIN32
|
||||
fqn_prefix_names[SYSCONFPREFIX]);
|
||||
#else
|
||||
fqn_prefix_names[HACKPREFIX]);
|
||||
#endif /* WIN32 */
|
||||
#else /* PREFIXES_IN_USE */
|
||||
buf[0] = '\0';
|
||||
#endif
|
||||
|
||||
raw_printf("Your system symbols file%s:", buf);
|
||||
#ifdef UNIX
|
||||
Sprintf(buf, "%s/%s", nhpath, SYMBOLS);
|
||||
#else
|
||||
#ifdef PREFIXES_IN_USE
|
||||
Sprintf(buf, "%s",
|
||||
fqname(SYMBOLS,
|
||||
#ifdef WIN32
|
||||
SYSCONFPREFIX, 2));
|
||||
#else
|
||||
HACKPREFIX, 2));
|
||||
#endif
|
||||
#endif /* PREFIXES_IN_USE */
|
||||
#endif /* UNIX */
|
||||
raw_printf(" \"%s\"", buf);
|
||||
|
||||
/* configuration file */
|
||||
#ifdef PREFIXES_IN_USE
|
||||
Sprintf(buf, " (in %s)",
|
||||
fqn_prefix_names[CONFIGPREFIX]);
|
||||
#else /* PREFIXES_IN_USE */
|
||||
buf[0] = '\0';
|
||||
#endif
|
||||
raw_printf("Your personal configuration file%s:", buf);
|
||||
#ifdef UNIX
|
||||
envp = nh_getenv("HOME");
|
||||
if (!envp)
|
||||
Strcpy(nhpath, ".nethackrc");
|
||||
else
|
||||
Sprintf(nhpath, "%s/%s", envp, default_configfile);
|
||||
#endif
|
||||
raw_printf(" \"%s\"",
|
||||
#ifdef UNIX
|
||||
nhpath);
|
||||
#else
|
||||
#ifdef PREFIXES_IN_USE
|
||||
fqname(default_configfile, CONFIGPREFIX, 3));
|
||||
#else
|
||||
default_configfile);
|
||||
#endif /* PREFIXES_IN_USE */
|
||||
#endif /* UNIX */
|
||||
raw_print("");
|
||||
}
|
||||
|
||||
/* ---------- BEGIN TRIBUTE ----------- */
|
||||
|
||||
/* 3.6 tribute code
|
||||
|
||||
Reference in New Issue
Block a user