nanosaur: update patch for better data folder handling (#6898)

This commit is contained in:
augiedoggie
2022-05-08 13:57:22 -06:00
committed by GitHub
parent 2bea9faac6
commit 87dfa916c9
2 changed files with 46 additions and 40 deletions

View File

@@ -5,7 +5,7 @@ sent back in time 20 minutes before a giant asteroid hits the Earth."
HOMEPAGE="https://pangeasoft.net/nano"
COPYRIGHT="1998 Pangea Software, Inc."
LICENSE="CC-BY-NC-SA-4.0"
REVISION="1"
REVISION="2"
SOURCE_URI="https://github.com/jorio/Nanosaur/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="5458ed6bf7d58facd7adf30161680546148b2a4e187c336b8af02cb864188da0"

View File

@@ -1,11 +1,11 @@
From c5dc01605d0ded5f7e990bfe52bde69e2ef27c3b Mon Sep 17 00:00:00 2001
From 83d1893b2d8e41112ef9420d5703d676c9ef0980 Mon Sep 17 00:00:00 2001
From: Ivan Holmes <ivan@ivanholmes.co.uk>
Date: Fri, 6 May 2022 22:22:59 +0100
Subject: Add Haiku header directory so we can find SDL2
diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake
index 27e773a..c9e1f09 100644
index 27e773a..42046d7 100644
--- a/cmake/FindSDL2.cmake
+++ b/cmake/FindSDL2.cmake
@@ -58,7 +58,7 @@ elseif(APPLE)
@@ -21,43 +21,7 @@ index 27e773a..c9e1f09 100644
2.30.2
From 7dd83117f6cc0f636cff289351b76d4a63da777a Mon Sep 17 00:00:00 2001
From: Ivan Holmes <ivan@ivanholmes.co.uk>
Date: Sat, 7 May 2022 00:11:00 +0100
Subject: use find_directory to find game data
diff --git a/src/Main.cpp b/src/Main.cpp
index 37e2986..f03bbad 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -10,6 +10,9 @@
#if __APPLE__
#include <libproc.h>
#include <unistd.h>
+#elif defined(__HAIKU__)
+#include <Path.h>
+#include <FindDirectory.h>
#endif
extern "C"
@@ -47,6 +50,11 @@ static fs::path FindGameData()
dataPath = pathbuf;
dataPath = dataPath.parent_path().parent_path() / "Resources";
+#elif defined(__HAIKU__)
+ BPath appsBPath;
+ find_directory(B_SYSTEM_APPS_DIRECTORY, &appsBPath);
+ dataPath = appsBPath.Path();
+ dataPath = dataPath / "Nanosaur" / "Data";
#else
dataPath = "Data";
#endif
--
2.30.2
From 4a1b97544e88aa4f50701cfd1ce8af7d1d4198df Mon Sep 17 00:00:00 2001
From fb097edf18e44b56082334be2d9a10bb35ce3c4e Mon Sep 17 00:00:00 2001
From: Ivan Holmes <ivan@ivanholmes.co.uk>
Date: Sat, 7 May 2022 00:16:00 +0100
Subject: Link with libbe
@@ -82,3 +46,45 @@ index b335bfe..dd2772a 100644
--
2.30.2
From dd1c449ab08bec7dadf5e26dbc52845fb11127f7 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Sun, 8 May 2022 13:50:12 -0600
Subject: locate data directory relative to the app on Haiku
diff --git a/src/Main.cpp b/src/Main.cpp
index 37e2986..577e6c0 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -10,6 +10,8 @@
#if __APPLE__
#include <libproc.h>
#include <unistd.h>
+#elif defined(__HAIKU__)
+#include <image.h>
#endif
extern "C"
@@ -47,6 +49,18 @@ static fs::path FindGameData()
dataPath = pathbuf;
dataPath = dataPath.parent_path().parent_path() / "Resources";
+#elif defined(__HAIKU__)
+ int32 cookie = 0;
+ image_info info;
+ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK)
+ {
+ if (info.type == B_APP_IMAGE)
+ {
+ dataPath = info.name;
+ dataPath = dataPath.parent_path() / "Data";
+ break;
+ }
+ }
#else
dataPath = "Data";
#endif
--
2.30.2