From c8f221320b2e186a0a657c8754b53de87679dfb6 Mon Sep 17 00:00:00 2001 From: Antoine Stevan Date: Wed, 7 Jul 2021 13:49:55 +0200 Subject: [PATCH] Recovery file. --- run | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/run b/run index 7efcc11..9e70878 100755 --- a/run +++ b/run @@ -2,15 +2,24 @@ # stash the original font and store the game font. terminal_font=$(gsettings get org.gnome.desktop.interface monospace-font-name) game_font='square 13' +dir_path=$(dirname "$0") +log_dir="$dir_path"/.log +recovery_file="$log_dir"/log.recovery -echo "- your previous terminal font was $terminal_font" -echo "- to recover previous font, in case of any crash from the game, please run" -echo "gsettings set org.gnome.desktop.interface monospace-font-name "$terminal_font"" +msg="- your previous terminal font was $terminal_font +- to recover previous font, in case of any crash from the game, please run +gsettings set org.gnome.desktop.interface monospace-font-name $terminal_font" + +if [[ ! -e $log_dir ]]; then mkdir -p $log_dir; fi + +echo "$msg" > "$recovery_file" +echo "in case of any problem, please refer to the recovery file with" +echo "cat $recovery_file" if [[ $(fc-list | grep -c square) == 0 ]]; then echo "square.ttf not found."; echo "please install the square font (available at https://strlen.com/square/) inside /usr/share/fonts, /usr/local/share/fonts or ~/.fonts"; else gsettings set org.gnome.desktop.interface monospace-font-name "$game_font"; - python $(dirname "$0")/src/main.py; + python "$dir_path"/src/main.py; gsettings set org.gnome.desktop.interface monospace-font-name "$terminal_font"; fi