File: load_data_from_system.patch

package info (click to toggle)
boulder-game 1.02%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,708 kB
  • sloc: ansic: 32,633; cpp: 13,838; makefile: 108
file content (37 lines) | stat: -rw-r--r-- 1,165 bytes parent folder | download | duplicates (2)
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
35
36
37
From: =?utf-8?q?Andreas_R=C3=B6nnquist?= <gusnan@debian.org>
Date: Fri, 22 Nov 2024 18:37:29 +0100
Subject: Fix finding data when it's installed to linux system locations

---
 src/common/global.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/common/global.cpp b/src/common/global.cpp
index 5f6f5f3..32c8728 100755
--- a/src/common/global.cpp
+++ b/src/common/global.cpp
@@ -193,12 +193,18 @@ bool C_Global::FindDataPath(const char *szDataFile)
 			//try exe_path/-Resources (Mac sandbox)
 			sprintf(szDataPath, "%s/../Contents/Resources/data", szExePath);
 			FixPath(szDataPath);
-			sprintf(szPath, "%s/%s", szDataPath, szDataFile);
-			pFile = fopen(szPath, "rb");
-		}
-		if (!pFile) {
-			szDataPath[0] = 0;
-		}
+			sprintf(szPath, "%s/%s", szDataPath, szDataFile);
+			pFile = fopen(szPath, "rb");
+		}
+		if (!pFile) {
+			sprintf(szDataPath, "/usr/share/boulder-game");
+			FixPath(szDataPath);
+			sprintf(szPath, "%s/%s", szDataPath, szDataFile);
+			pFile = fopen(szPath, "rb");
+		}
+		if (!pFile) {
+			szDataPath[0] = 0;
+		}
 		if (pFile) fclose(pFile);
 	}
 	return szDataPath[0] != 0;