From: warwick Date: Thu, 3 Apr 2003 04:21:57 +0000 (+0000) Subject: Allow both UNIX and MacOSX conventions for configfile. X-Git-Tag: MOVE2GIT~2041 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02fba50b34af769e91b89cb69fbafffef29c1e30;p=nethack Allow both UNIX and MacOSX conventions for configfile. --- diff --git a/src/files.c b/src/files.c index 2c06e91e1..61ba37a73 100644 --- a/src/files.c +++ b/src/files.c @@ -1530,7 +1530,15 @@ const char *filename; Sprintf(tmp_config, "%s/%s", envp, ".nethackrc"); if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) return(fp); - else if (errno != ENOENT) { +# if defined(__APPLE__) + /* try an alternative */ + if (envp) { + Sprintf(tmp_config, "%s/%s", envp, "Library/Preferences/NetHack Defaults"); + if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) + return(fp); + } +# endif + if (errno != ENOENT) { /* e.g., problems when setuid NetHack can't search home * directory restricted to user */ raw_printf("Couldn't open default config file %s (%d).",