summarylogtreecommitdiffstats
path: root/ysflight.sh
blob: 47e4e4e0977350d18766446b37ee7708e3eaae32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# Mirror files to the home directory
if [ ! -d "$HOME/.config/ysflight" ]; then
	[ -d "$HOME/.config" ] || mkdir "$HOME/.config"
	cp -r "YSFLIGHT_DIR/config" "$HOME/.config/ysflight"
fi
if [ -d "$HOME/.cache/ysflight" ] && [ "$0" -nt "$HOME/.cache/ysflight" ]; then
	rm -rf "$HOME/.cache/ysflight"
fi
if [ ! -d "$HOME/.cache/ysflight" ]; then
	cp -rs "YSFLIGHT_DIR" "$HOME/.cache/ysflight"
	rm -rf "$HOME/.cache/ysflight/config"
	ln -s "$HOME/.config/ysflight" "$HOME/.cache/ysflight/config"
fi

# Launch YsFlight
cd "$HOME/.cache/ysflight/"
exe="${0##*/}"
[ -e "$exe" ] || exe="ysflight64_gl2"
exec ./$exe "$@"