Files
haikuports/games-arcade/defendguin/patches/defendguin-0.0.12.patchset

62 lines
1.6 KiB
Plaintext

From 64c29df0298e2bd1c036047f47cb2dbc36f70972 Mon Sep 17 00:00:00 2001
From: Abdur-Raheem Idowu <abdurraheemidowu@gmail.com>
Date: Wed, 15 Jan 2020 09:57:38 +0000
Subject: Loads&saves in Haiku's settings directory
diff --git a/src/defendguin.c b/src/defendguin.c
index 60f04e8..d4f1a18 100644
--- a/src/defendguin.c
+++ b/src/defendguin.c
@@ -33,6 +33,9 @@
#define M_PI 3.14159265358979323846 /* mmm... pi... */
#endif /* #ifndef M_PI */
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
/* Image enumerations: */
@@ -5884,7 +5887,18 @@ void load_options(void)
if (getenv("HOME") != NULL)
{
+#ifdef __HAIKU__
+ char path[PATH_MAX];
+ dev_t bootdev = dev_for_path("/boot");
+ if (bootdev < 0)
+ bootdev = 0;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, bootdev, false,
+ path, sizeof(path) - 1) == B_OK) {
+ snprintf(fname, sizeof(fname), "%s/defendguinrc", path);
+ }
+#else
snprintf(fname, sizeof(fname), "%s/.defendguinrc", getenv("HOME"));
+#endif
fi = fopen(fname, "r");
@@ -5948,7 +5962,18 @@ void save_options(void)
if (getenv("HOME") != NULL)
{
+#ifdef __HAIKU__
+ char path[PATH_MAX];
+ dev_t bootdev = dev_for_path("/boot");
+ if (bootdev < 0)
+ bootdev = 0;
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, bootdev, false,
+ path, sizeof(path) - 1) == B_OK) {
+ snprintf(fname, sizeof(fname), "%s/defendguinrc", path);
+ }
+#else
snprintf(fname, sizeof(fname), "%s/.defendguinrc", getenv("HOME"));
+#endif
fi = fopen(fname, "w");
--
2.19.0