From a4ba73099a91385bf91ef37dee5c7eb765f69372 Mon Sep 17 00:00:00 2001 From: Raheem Idowu <55973312+R4H33M@users.noreply.github.com> Date: Wed, 15 Jan 2020 15:44:42 +0400 Subject: [PATCH] defendguin: loads from and saves in Haiku's settings directory (#4584) --- .../defendguin/defendguin-0.0.12.recipe | 3 +- .../patches/defendguin-0.0.12.patchset | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 games-arcade/defendguin/patches/defendguin-0.0.12.patchset diff --git a/games-arcade/defendguin/defendguin-0.0.12.recipe b/games-arcade/defendguin/defendguin-0.0.12.recipe index aad4b57d0..3a217cf3b 100644 --- a/games-arcade/defendguin/defendguin-0.0.12.recipe +++ b/games-arcade/defendguin/defendguin-0.0.12.recipe @@ -5,9 +5,10 @@ from being captured and mutated." HOMEPAGE="http://www.newbreedsoftware.com/defendguin/" COPYRIGHT="1999-2009 Bill Kendrick" LICENSE="GNU GPL v2" -REVISION="3" +REVISION="4" SOURCE_URI="ftp://ftp.tuxpaint.org/unix/x/defendguin/src/defendguin-0.0.12.tar.gz" CHECKSUM_SHA256="3c248bed480b291901b7509525dc952be6d28dfa47fd6f8e3fb9873f46017330" +PATCHES="defendguin-$portVersion.patchset" ARCHITECTURES="x86_gcc2 x86 x86_64" diff --git a/games-arcade/defendguin/patches/defendguin-0.0.12.patchset b/games-arcade/defendguin/patches/defendguin-0.0.12.patchset new file mode 100644 index 000000000..faf9378a6 --- /dev/null +++ b/games-arcade/defendguin/patches/defendguin-0.0.12.patchset @@ -0,0 +1,61 @@ +From 64c29df0298e2bd1c036047f47cb2dbc36f70972 Mon Sep 17 00:00:00 2001 +From: Abdur-Raheem Idowu +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 ++#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 +