From 6bd9b1c6ace4f25a0bdd4bfdfdbc7f6bacf43289 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 8 Oct 2019 22:51:22 +0200 Subject: [PATCH] Ensure to restore all Steam directories --- games/save.game.steam | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/games/save.game.steam b/games/save.game.steam index b1bb77c..1475d40 100755 --- a/games/save.game.steam +++ b/games/save.game.steam @@ -50,7 +50,7 @@ steam_userdata_games="760 35700 35720 55230 204360 206420 218820 247080 255870 3 ### 686200 − Door Kickers: Action Squad − https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad steam_compatdata_games="686200" # }}} -# List of Steam saves in steamapps to backup {{{ +## List of Steam saves in steamapps to backup {{{ ### 274190 − Broforce − https://pcgamingwiki.com/wiki/Broforce # }}} ## Ids without backups in userdata {{{ @@ -73,9 +73,6 @@ ignore_pattern_steam_id="(7|620|49520|55230|213670|219150|241100|242680|251470|2 ## }}} remote_dir="${HOME}/Nextcloud/games/linux.sgl.script" -remote_steam_userdata="${remote_dir}/${steam_userdata}" - -local_steam_userdata="${HOME}/${steam_userdata}" local_unmanaged_games_list="/tmp/unmanaged_games_list" # }}} @@ -127,17 +124,20 @@ if [ ! -d "${remote_dir}" ]; then exit 1 fi ## }}} -## Ensure Steam dir exist {{{ -if [ ! -d "${local_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_local_steam_userdata - if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; then - mkdir -p -- "${local_steam_userdata}" - else - printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script." - exit 2 +## Ensure Steam directories exist {{{ +for steam_dir in "${steam_userdata}" "${steam_compatdata}"; do + local_steam_path="${HOME}/${steam_dir}" + if [ ! -d "${local_steam_path}" ]; then + printf '\e[1;35m%-6s\e[m\n' "The Steam directory − ${steam_dir} for your ID (${steam_id}) doesn't exists yet… Should it must be create (for restoration,…) [Y/n] ?" + read -r create_local_steam_userdata + if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; then + mkdir -p -- "${local_steam_path}" + else + printf '\e[1;35m%-6s\e[m\n' "Steam directory (${steam_dir}) doesn't exists, abort script." + exit 2 + fi fi -fi +done ## }}} # }}} @@ -200,7 +200,7 @@ for game_id in ${steam_compatdata_games}; do done # }}} # List userdata unmanage game id {{{ -cd -- "${local_steam_userdata}" || exit 1 +cd -- "${HOME}/${steam_userdata}" || exit 1 rm -f -- "${local_unmanaged_games_list}" find . -maxdepth 1 -type d | grep -vE "${ignore_pattern_steam_id}" > "${local_unmanaged_games_list}" if [ -s "${local_unmanaged_games_list}" ]; then