libsdl2: do not chdir if started from Terminal.

Fixes #8322
This commit is contained in:
PulkoMandy
2023-04-13 17:50:02 +02:00
parent fdfa4c8c73
commit d08aae56fe
2 changed files with 33 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ software, emulators, and popular games."
HOMEPAGE="https://www.libsdl.org/"
COPYRIGHT="1997-2022 Sam Lantinga"
LICENSE="Zlib"
REVISION="3"
REVISION="4"
SOURCE_URI="https://www.libsdl.org/release/SDL2-$portVersion.tar.gz"
CHECKSUM_SHA256="1a0f686498fb768ad9f3f80b39037a7d006eac093aad39cb4ebcc832a8887231"
SOURCE_DIR="SDL2-$portVersion"

View File

@@ -1,4 +1,4 @@
From 6fbc3b5f76680ccdd604c9822c4ab0d8b6a05b6d Mon Sep 17 00:00:00 2001
From 7a4fc529d097359a985556cb2f5ba601c8de3a0f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 12 Jan 2022 11:59:06 +1000
Subject: Workaround for gcc2
@@ -23,7 +23,7 @@ index 5c3f012..6fc3c14 100644
2.37.3
From bc391bc6d7ff37f9b73c2c9bbe466ef64bc8ca0c Mon Sep 17 00:00:00 2001
From 66219afffdd033230f687202256eb0d9249845f2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 29 Mar 2023 21:28:21 +0200
Subject: Haiku: use a BLooper for events.
@@ -437,3 +437,33 @@ index a9cc173..b79f34b 100644
--
2.37.3
From f18aaee1b460e83d78531807f856d1dc0dcddada Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Thu, 13 Apr 2023 17:38:14 +0200
Subject: Don't change the current directory when starting from Terminal.
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index 5dea3a4..3dfa430 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -119,9 +119,13 @@ StartBeLooper()
} while ((be_app == NULL) || be_app->IsLaunching());
}
- /* Change working directory to that of executable */
+ /* If started from the GUI, change working directory to that of executable.
+ * This matches behavior on other platforms and may be needed by some SDL software.
+ * Don't do it when started from terminal (TERM environment variable is set), because in that
+ * case, the current directory may be important, and after this there will be no way to know
+ * what it was. */
app_info info;
- if (B_OK == be_app->GetAppInfo(&info)) {
+ if (NULL == getenv("TERM") && B_OK == be_app->GetAppInfo(&info)) {
entry_ref ref = info.ref;
BEntry entry;
if (B_OK == entry.SetTo(&ref)) {
--
2.37.3