diff --git a/games/save.game.steam b/games/save.game.steam index ca9f70b..316a61d 100755 --- a/games/save.game.steam +++ b/games/save.game.steam @@ -43,6 +43,9 @@ steam_compatdata=".steam/steam/steamapps/compatdata" ### 359840 − Shift Happens − https://pcgamingwiki.com/wiki/Shift_Happens steam_userdata_games="760 35700 35720 55230 204360 206420 218820 247080 255870 312530 359840" ## }}} +## Pattern of Steam saves in common to backup {{{ +### 274190 − Broforce − https://pcgamingwiki.com/wiki/Broforce +# }}} ## Pattern of Steam saves in compatdata to backup {{{ ### Compatdata contains directories for games using Steam play so it's too big ### to be fully moved to a remote storage. @@ -55,9 +58,6 @@ 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_pattern="213670/save 312610/UserDefault.xml 686200/userdata.bin" # }}} -## List of Steam saves in steamapps to backup {{{ -### 274190 − Broforce − https://pcgamingwiki.com/wiki/Broforce -# }}} ## Ids without backups in userdata {{{ ### 7 − Unknown ### 620 − Portal 2 − https://pcgamingwiki.com/wiki/Portal_2 @@ -183,44 +183,50 @@ for game_pattern in ${steam_compatdata_games_pattern}; do game_id="$(echo ${game_pattern} | cut -d"/" -f1)" save_pattern="$(echo ${game_pattern} | cut -d"/" -f2)" - ### Follow symbolic links but avoid links to dosdevices and keep only one result - temp_local_save_path="$(find -L "${HOME}/${steam_compatdata}/${game_id}" -ipath "*dosdevices*" -prune -o -iname "${save_pattern}" | grep -v "dosdevices" | head -n 1)" - local_save_path="$(dirname "${temp_local_save_path}")" - local_save_path_type="$(ls -ld "${local_save_path}" | sed 's/\(^.\).*/\1/')" - ## Path independent from local or remote base directory - steam_dir="$(printf "%s" "${local_save_path}" | sed -e "s;${HOME}/;;")" + ## If the game is installed + if [ -d "${HOME}/${steam_compatdata}/${game_id}" ]; then - ## Print vars {{{ - #if [ "${debug}" -eq "0" ]; then - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : game ID : ${game_id}" - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : save pattern : ${save_pattern}" - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : temp local save path : ${temp_local_save_path}" - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save path : ${local_save_path}" - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save type : ${local_save_path_type}" - #printf '\e[1;35m%-6s\e[m\n' "DEBUG : steam dir : ${steam_dir}" - #fi - ## }}} + ### Follow symbolic links but avoid links to dosdevices and keep only one result + temp_local_save_path="$(find -L "${HOME}/${steam_compatdata}/${game_id}" -ipath "*dosdevices*" -prune -o -iname "${save_pattern}" | grep -v "dosdevices" | head -n 1)" + local_save_path="$(dirname "${temp_local_save_path}")" + local_save_path_type="$(ls -ld "${local_save_path}" | sed 's/\(^.\).*/\1/')" + ## Path independent from local or remote base directory + steam_dir="$(printf "%s" "${local_save_path}" | sed -e "s;${HOME}/;;")" - case ${local_save_path_type} in - ## Data is already a symlink - "symbolic"|"symboliclink"|"l") - [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — The data of ${game_id} are already symlinked to .... Skip." - ;; - ## Data is still a directory, try to move it - "directory"|"d") - move_steam_game_dir "$(basename "${steam_dir}")" "$(dirname "${steam_dir}")" - ;; - ## Data doesn't exist - "cannot") - [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — The data of ${game_id} − ${local_save_path} doesn't exist. Skip." - ### TODO : Try to symlink - ;; - ## Data can't be managed - *) - printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (compatdata) − ${local_save_path} are not managed. Type: ${local_save_path_type}. Abort." - exit 3 - ;; - esac + ## Print vars {{{ + #if [ "${debug}" -eq "0" ]; then + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : game ID : ${game_id}" + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : save pattern : ${save_pattern}" + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : temp local save path : ${temp_local_save_path}" + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save path : ${local_save_path}" + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save type : ${local_save_path_type}" + #printf '\e[1;35m%-6s\e[m\n' "DEBUG : steam dir : ${steam_dir}" + #fi + ## }}} + + case ${local_save_path_type} in + ## Data is already a symlink + "symbolic"|"symboliclink"|"l") + [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — The data of ${game_id} are already symlinked to .... Skip." + ;; + ## Data is still a directory, try to move it + "directory"|"d") + move_steam_game_dir "$(basename "${steam_dir}")" "$(dirname "${steam_dir}")" + ;; + ## Data doesn't exist + "cannot") + [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — The data of ${game_id} − ${local_save_path} doesn't exist. Skip." + ### TODO : Try to symlink + ;; + ## Data can't be managed + *) + printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (compatdata) − ${local_save_path} are not managed. Type: ${local_save_path_type}. Abort." + exit 3 + ;; + esac + else ## The game is not present on the system + [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — ${game_id} doesn't seems to be installed on the system. Skip." + fi done # }}}