summaryrefslogtreecommitdiff
path: root/tw/packages/files/simutrans-paths.patch
blob: bfc0db4a99f878b395072a631b58dab2bff0d3a6 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
This patch stores user-specific config in $XDG_CONFIG_HOME/simutrans
rather than ~/simutrans.

--- a/sys/simsys.cc	2022-09-25 01:36:18.951636483 +0200
+++ b/sys/simsys.cc	2022-09-25 01:36:44.615457050 +0200
@@ -395,7 +395,11 @@
 #elif defined __ANDROID__
 	tstrncpy(buffer,SDL_GetPrefPath("Simutrans Team","simutrans"),lengthof(buffer));
 #else
-	sprintf(buffer, "%s/simutrans", getenv("HOME"));
+	if (getenv("XDG_CONFIG_HOME") == NULL) {
+		sprintf(buffer, "%s/.config/simutrans", getenv("HOME"));
+	} else {
+		sprintf(buffer, "%s/simutrans", getenv("XDG_CONFIG_HOME"));
+	}
 #endif
 
 	// create directory and subdirectories