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 +## }}} + +# }}}