summarylogtreecommitdiffstats
path: root/path-for-game-data.patch
blob: 4ab0b4942ac9b68c61a3d1a897ec8f12d3afe319 (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
--- simmain.cc.orig	2020-08-31 22:02:10.283408370 +0200
+++ simmain.cc	2020-08-31 22:07:57.497785796 +0200
@@ -428,6 +428,13 @@

 	env_t::init();

++    // Make simutrans re-symlinks the files when opened
+#ifdef __linux__
+	system("\cp --remove-destination ~/.local/share/simutrans/config/simuconf.tab ~/.local/share/simutrans/config/simuconf-backup.tab");
+	system("\cp -rs --remove-destination /usr/share/games/simutrans/ ~/.local/share/");
+	system("\cp --remove-destination ~/.local/share/simutrans/config/simuconf-backup.tab ~/.local/share/simutrans/config/simuconf.tab");
+#endif
+
 	// you really want help with this?
 	if (gimme_arg(argc, argv, "-h",     0) ||
 			gimme_arg(argc, argv, "-?",     0) ||
@@ -513,8 +520,9 @@
 		strcat( env_t::program_dir, PATH_SEPARATOR );
 	}
 	else {
-		strcpy( env_t::program_dir, argv[0] );
-		*(strrchr( env_t::program_dir, PATH_SEPARATOR[0] )+1) = 0;
+        static char buffer[100];
+        sprintf(buffer, "%s/.local/share/simutrans/", getenv("HOME"));
+        strcpy(env_t::program_dir, buffer);

 #ifdef __APPLE__
 		// change working directory from binary dir to bundle dir