]> granicus.if.org Git - nethack/commitdiff
Allow both UNIX and MacOSX conventions for configfile.
authorwarwick <warwick>
Thu, 3 Apr 2003 04:21:57 +0000 (04:21 +0000)
committerwarwick <warwick>
Thu, 3 Apr 2003 04:21:57 +0000 (04:21 +0000)
src/files.c

index 2c06e91e1bae5b080d4a74aadb58bff5eb1ccf6a..61ba37a73e192bd5145455ce0ff3768c8413c735 100644 (file)
@@ -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).",