0
0
Fork 0
haikuports/games-kids/abe/patches/abe-1.1.patch

81 lines
2.0 KiB
Diff

diff --git a/src/Directories.c b/src/Directories.c
index cca0472..f43d181 100644
--- a/src/Directories.c
+++ b/src/Directories.c
@@ -7,7 +7,12 @@ getHomeUserAbe()
{
static char path[PATH_SIZE];
-#ifndef WIN32
+#ifdef WIN32
+ sprintf(path, xstr(BASE_DIR) PATH_SEP);
+#elif __HAIKU__
+ find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, path, PATH_SIZE);
+ strncat(path, "/abe/", PATH_SIZE);
+#else
struct passwd *pwent;
pwent = getpwuid(getuid());
@@ -17,8 +22,6 @@ getHomeUserAbe()
}
sprintf(path, "%s%s", pwent->pw_dir, PATH_SEP ".abe" PATH_SEP);
-#else
- sprintf(path, xstr(BASE_DIR) PATH_SEP);
#endif
return path;
diff --git a/src/Directories.h b/src/Directories.h
index 3abe73e..45e8d12 100644
--- a/src/Directories.h
+++ b/src/Directories.h
@@ -9,6 +9,10 @@
#include <unistd.h>
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
// The macros xstr(s) and str(s) were extracted from
// http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
// They are used to expand BASE_DIR .
diff --git a/src/Main.c b/src/Main.c
index 2520856..a158796 100644
--- a/src/Main.c
+++ b/src/Main.c
@@ -90,12 +90,22 @@ main(int argc, char *argv[])
int intro = 0;
char *mapname;
int mapwidth, mapheight;
+ char *directory;
+ char *sep;
mainstruct.drawBackground = 1;
mainstruct.alphaBlend = 1;
mainstruct.effects_enabled = 1;
runmode = RUNMODE_SPLASH;
mainstruct.full_screen = 1;
+
+ directory = strdup(argv[0]);
+ sep = strrchr(directory, '/');
+ if (sep != NULL) {
+ *sep = '\0';
+ chdir(directory);
+ }
+ free(directory);
// my laptop can't handle fullscreen for some reason
#if defined(__APPLE__) || defined(__MACH_O__)
--- abe-1.1/src/Main.c.org 2016-05-05 22:29:36.874774528 +0200
+++ abe-1.1/src/Main.c 2016-05-05 22:27:07.532414464 +0200
@@ -108,7 +108,7 @@
free(directory);
// my laptop can't handle fullscreen for some reason
-#if defined(__APPLE__) || defined(__MACH_O__)
+#if defined(__APPLE__) || defined(__MACH_O__) || defined(__HAIKU__)
mainstruct.full_screen = 0;
#endif