From a123598f2ae7d64f895624bc24f536e978820060 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Sat, 5 Oct 2019 19:58:08 +0200 Subject: [PATCH] New save game script Check if remote_dir and steam_id dir exists. --- save.game.link | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 save.game.link diff --git a/save.game.link b/save.game.link new file mode 100755 index 0000000..61ac2bf --- /dev/null +++ b/save.game.link @@ -0,0 +1,31 @@ +#!/bin/sh + +# Vars {{{ +remote_dir="${HOME}/Nextcloud/games/linux.sgl.script" + +steam_id="1" +steam_userdata="${HOME}/.steam/steam/userdata/${steam_id}" +# }}} + +# Tests {{{ + +## Ensure remote dir exist {{{ +if [ ! -d "${remote_dir}" ]; then + printf '\e[1;35m%-6s\e[m\n' "The directory for save game doesn't exists : ${remote_dir}" + exit 1 +fi +## }}} +## Ensure Steam dir exist {{{ +if [ ! -d "${steam_userdata}" ]; then + printf '\e[1;35m%-6s\e[m\n' "The Steam directory for your ID (${steam_id}) doesn't exists yet… Should it must be create (for restoration,…) [Y/n] ?" + read -r create_steam_userdata + if [ "${create_steam_userdata}" = "" ] || [ "${create_steam_userdata}" = "Y" ] || [ "${create_steam_userdata}" = "y" ]; then + mkdir -p -- "${steam_userdata}" + else + printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script." + exit 2 + fi +fi +## }}} + +# }}}