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:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user