summarylogtreecommitdiffstats
path: root/soniccd-launcher
diff options
context:
space:
mode:
Diffstat (limited to 'soniccd-launcher')
-rwxr-xr-xsoniccd-launcher26
1 files changed, 26 insertions, 0 deletions
diff --git a/soniccd-launcher b/soniccd-launcher
new file mode 100755
index 000000000000..1f41fc85e9fd
--- /dev/null
+++ b/soniccd-launcher
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Get the XDG data home or default if not set, then append a 'soniccd' folder.
+data_folder="${XDG_DATA_HOME:-${HOME}/.local/share}/soniccd"
+
+# Check if it exists, if not, create it and exit with error code 1.
+if [[ ! -d "$data_folder" ]]; then
+ mkdir -p "$data_folder"
+ echo "Created data folder in '$data_folder', please copy the game's data" \
+"files there and run this launcher again."
+ exit 1
+fi
+
+# Check if the user forgot to copy data files, if not exit with error code 1.
+#
+# If we don't do this check, the game will still create the settings and save
+# files, but not run (nor set an error code), which can be confusing to the
+# end user.
+if [[ -z "$(ls -A $data_folder)" ]]; then
+ echo "Data folder appears to be empty, please copy the game's data files" \
+"and run this launcher again."
+ exit 1
+fi
+
+cd "$data_folder"
+/usr/bin/soniccd