summarylogtreecommitdiffstats
path: root/soniccd-launcher
blob: 211b709f38cc73cd3a233a54e440b4fc1c76b5e9 (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
#!/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

cd "$data_folder"
/usr/bin/soniccd

exit_code=$?

# When implemented, exit code 1 will indicate missing data.
# Let's hope that doesn't change, right? :D
if [[ $exit_code -eq 1 ]]; then
	echo "'/usr/bin/soniccd' exited with error code 1, did you forget to" \
"copy the game's data files to '$data_folder'?"
fi

exit $exit_code