summarylogtreecommitdiffstats
path: root/clonehero
blob: 2bad7c7b82028330a049bcdd93bd7b780395bd76 (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
29
30
#!/bin/bash

# Create/locate local user folder for the game.
xdg_data_home="${XDG_DATA_HOME:-$HOME/.local/share}"
dir="$xdg_data_home/clonehero"

if ! mkdir -p "$dir"; then
	echo "Failed to create directory at ยด$dir'"
	exit 1
fi

if ! cd "$dir"; then
	echo "Failed to change to directory '$dir'"
	exit 1
fi

# We have to copy the required files to get the game to run in a local user
# directory. Symbolic linking leads to runtime errors, running with a different
# working directory than the binary doesn't work either.
for f in clonehero_Data clonehero UnityPlayer.so; do
	if ! cp -rf "/opt/clonehero/$f" "$dir/$f"; then
		echo "Failed to copy '$f' to '$dir/$f'"
		exit 1
	fi
done

# We won't touch neither the Custom/ nor Songs/ directories as those are
# probably best left to the user to populate (or link to another folder).

exec ./clonehero "$@"