summarylogtreecommitdiffstats
path: root/soniccd-launcher
blob: 1f41fc85e9fd2ba38975ed290b56ed81d332a1ea (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

# 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