--- src/savegame.c.orig +++ src/savegame.c @@ -21,23 +21,24 @@ char *partySavFilename() { char *fname; -#if defined(MACOSX) char *home; home = getenv("HOME"); if (home && home[0]) { fname = (char *) malloc(strlen(home) + +#if defined(MACOSX) strlen(MACOSX_USER_FILES_PATH) + +#endif +strlen("/.u4/") + strlen(PARTY_SAV_BASE_FILENAME) + 2); strcpy(fname, home); +#if defined(MACOSX) strcat(fname, MACOSX_USER_FILES_PATH); - strcat(fname, "/"); +#endif + strcat(fname, "/.u4/"); strcat(fname, PARTY_SAV_BASE_FILENAME); } else fname = strdup(PARTY_SAV_BASE_FILENAME); -#else - fname = strdup(PARTY_SAV_BASE_FILENAME); -#endif return fname; } @@ -45,24 +45,24 @@ char *monstersSavFilename() { char *fname; -#if defined(MACOSX) char *home; home = getenv("HOME"); if (home && home[0]) { fname = (char *) malloc(strlen(home) + +#if defined(MACOSX) strlen(MACOSX_USER_FILES_PATH) + +#endif +strlen("/.u4/") + strlen(MONSTERS_SAV_BASE_FILENAME) + 2); strcpy(fname, home); +#if defined(MACOSX) strcat(fname, MACOSX_USER_FILES_PATH); - strcat(fname, "/"); +#endif + strcat(fname, "/.u4/"); strcat(fname, MONSTERS_SAV_BASE_FILENAME); } else fname = strdup(MONSTERS_SAV_BASE_FILENAME); -#else - fname = strdup(MONSTERS_SAV_BASE_FILENAME); -#endif - return fname; } --- src/u4.c.orig +++ src/u4.c @@ -38,6 +38,10 @@ osxInit(argv[0]); #endif + if (getenv("HOME")) { + chdir(getenv("HOME")); + mkdir(".u4", 0777); + } settingsRead(); for (i = 1; i < (unsigned int)argc; i++) {