summaryrefslogtreecommitdiff
path: root/Ports/Super-Mario/patches/0001-chdir-to-the-installed-directory-before-execution.patch
blob: 6f08ba2eccbfc85476889a269b41ec5846fb4759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Fri, 4 Jun 2021 00:29:36 +0200
Subject: [PATCH] chdir() to the installed directory before execution

The game expects its assets in the current directory, but we install
those to /opt/Super_Mario, so chdir() there at program startup to avoid
crashing.
---
 src/main.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 040eb56..ca14d6f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,10 +1,15 @@
 #include "header.h"
 #include "Core.h"
+#include <unistd.h>
 
 int main(int argc, const char* argv[]) {
-    CCore oCore;
+    chdir("/opt/Super_Mario");
 
-    oCore.mainLoop();
+    {
+        CCore oCore;
+
+        oCore.mainLoop();
+    }
     
     return 0;
 }