Create symlink to local if remote data exist

This commit is contained in:
gardouille 2019-10-05 21:06:33 +02:00
parent 54d820edd3
commit a1f6b93474

View File

@ -37,6 +37,21 @@ move_steam_game_dir() {
fi
}
# }}}
# Symlink one Steam save game dir from remote to local {{{
symlink_steam_game_dir() {
_game_id="${1}"
_local_game_path="${local_steam_userdata}/${_game_id}"
_remote_game_path="${remote_steam_userdata}/${_game_id}"
if [ -d "${_remote_game_path}" ]; then
ln -s -- "${_remote_game_path}" "${_local_game_path}"
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Symlink Steam game — Symlink remote data of ${_game_id} to local storage."
else
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Symlink Steam game — ${_game_id} doesn't have remote data."
fi
}
# }}}
# }}}
# Tests {{{
@ -80,6 +95,7 @@ for game_id in ${steam_games}; do
## Data can't be managed
"cannot")
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Steam for loop — The data of ${game_id} ${local_game_path} doesn't exist. Skip."
symlink_steam_game_dir "${game_id}"
;;
*)
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"