early directory validation

Allow early prefix directory validation to help prevent
failed games and lost save files due to incorrect config
file settings.
This commit is contained in:
nethack.allison
2002-07-01 22:42:57 +00:00
parent 8d0b3091cb
commit ea268b5b6f
5 changed files with 51 additions and 2 deletions

View File

@@ -105,6 +105,9 @@ char *argv[];
register int fd;
register char *dir;
#ifdef NOCWD_ASSUMPTIONS
char failbuf[BUFSZ];
#endif
#if defined(__BORLANDC__) && !defined(_WIN32)
startup();
@@ -171,6 +174,14 @@ char *argv[];
#endif
initoptions();
#ifdef NOCWD_ASSUMPTIONS
if (!validate_prefix_locations(failbuf)) {
raw_printf("Some invalid directory locations were specified:\n\t%s\n",
failbuf);
nethack_exit(EXIT_FAILURE);
}
#endif
#if defined(TOS) && defined(TEXTCOLOR)
if (iflags.BIOS && iflags.use_color)
set_colors();

View File

@@ -186,7 +186,7 @@ gotlock:
chdirx(orgdir, 0);
#if defined(WIN32)
error("cannot creat file (%s.)\n%s\n%s\"%s\" exists?\n",
fq_lock, strerror(ern), "Are you sure that the directory",
fq_lock, strerror(ern), " Are you sure that the directory",
fqn_prefix[LEVELPREFIX]);
#else
error("cannot creat file (%s.)", fq_lock);