summarylogtreecommitdiffstats
path: root/launch-thiswarofmine.sh
diff options
context:
space:
mode:
authorAlex Szczuczko2015-06-10 19:31:34 +0100
committerAlex Szczuczko2015-06-10 19:31:34 +0100
commit27360d45e30a10efafc3fdff1c629252e9a6bce4 (patch)
treed71da10de18ec80a94a129ccee02dc89d5338137 /launch-thiswarofmine.sh
downloadaur-27360d45e30a10efafc3fdff1c629252e9a6bce4.tar.gz
Initial import
Diffstat (limited to 'launch-thiswarofmine.sh')
-rw-r--r--launch-thiswarofmine.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/launch-thiswarofmine.sh b/launch-thiswarofmine.sh
new file mode 100644
index 000000000000..4de4c2658c1a
--- /dev/null
+++ b/launch-thiswarofmine.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# This is a wrapper that works around the application's single-user design for multi-user systems.
+
+set -e
+set -u
+
+game_dir="/opt/thiswarofmine-gog"
+: ${XDG_DATA_HOME:=$HOME/.local/share}
+user_dir="$XDG_DATA_HOME/thiswarofmine-gog"
+
+make_user_dir() {
+ echo "Creating a user directory for the game. This only needs to be done once, future runs will skip this step."
+
+ mkdir -p "$user_dir/"
+
+ # Read-only
+ find "$game_dir/" -maxdepth 1 -print0 | xargs -0 ln -s -t "$user_dir/"
+
+ echo "User directory has been created."
+}
+
+launch_game() {
+ cd "$user_dir"
+ ./"This War of Mine"
+}
+
+if [ ! -f "$user_dir/This War of Mine" ]
+then
+ make_user_dir
+fi
+
+launch_game