forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0.9-savegame.patch
76 lines (68 loc) · 1.68 KB
/
0.9-savegame.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- 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++) {