summarylogtreecommitdiffstats
path: root/bgb
diff options
context:
space:
mode:
authorQuint Guvernator2020-05-27 22:32:00 +0200
committerQuint Guvernator2020-05-27 22:32:19 +0200
commit847e9f7a60f1b92f97c7f0ea34add98d9a7300c9 (patch)
treeace87554a91132a9a89bcffa9b82a57a4bdce241 /bgb
parent474b3ac5d94ca61c1eeb928561a9f9905e58a9fe (diff)
downloadaur-847e9f7a60f1b92f97c7f0ea34add98d9a7300c9.tar.gz
save bgb settings in XDG_CONFIG_HOME
Diffstat (limited to 'bgb')
-rwxr-xr-xbgb19
1 files changed, 18 insertions, 1 deletions
diff --git a/bgb b/bgb
index d3f6fb901b5..ca940fbbefc 100755
--- a/bgb
+++ b/bgb
@@ -1,2 +1,19 @@
#!/bin/sh
-exec wine /usr/lib/bgb/bgb.exe $@
+set -e
+
+BGB_EXE=/usr/lib/bgb/bgb.exe
+BGB_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/bgb"
+BGB_CONFIG="$BGB_CONFIG_DIR/bgb.ini"
+
+mkdir -p "$BGB_CONFIG_DIR"
+
+tmp="$(mktemp -d)"
+cp -t "$tmp" "$BGB_EXE"
+if [ -e "$BGB_CONFIG" ]; then
+ cp -t "$tmp" "$BGB_CONFIG"
+fi
+
+wine "$tmp/$(basename "$BGB_EXE")" $@
+
+cp -t "$BGB_CONFIG_DIR" "$tmp/$(basename "$BGB_CONFIG")"
+rm -r "$tmp"