Exit if the pattern don't get give valid result

This commit is contained in:
Jeremy Gardais 2019-11-01 14:00:23 +01:00
parent 739e873898
commit 1c788b525a
1 changed files with 7 additions and 0 deletions

View File

@ -257,6 +257,12 @@ for game_pattern in ${steam_compatdata_games_pattern}; do
### Follow symbolic links but avoid links to dosdevices and keep only one result ### 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)" temp_local_save_path="$(find -L "${HOME}/${steam_compatdata}/${game_id}" -ipath "*dosdevices*" -prune -o -iname "${save_pattern}" | grep -v "dosdevices" | head -n 1)"
### Verify if the previous command successfully return an existing path
if [ ! -e "${temp_local_save_path}" ]; then
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (compatdata) Can't find the path to ${save_pattern} pattern. Result of find: ${temp_local_save_path} . Abort."
exit 3
fi
local_save_path="$(dirname "${temp_local_save_path}")" local_save_path="$(dirname "${temp_local_save_path}")"
local_save_path_type="$(ls -ld "${local_save_path}" | sed 's/\(^.\).*/\1/')" local_save_path_type="$(ls -ld "${local_save_path}" | sed 's/\(^.\).*/\1/')"
## Path independent from local or remote base directory ## Path independent from local or remote base directory
@ -281,6 +287,7 @@ for game_pattern in ${steam_compatdata_games_pattern}; do
;; ;;
## Data is still a directory, try to move it ## Data is still a directory, try to move it
"directory"|"d") "directory"|"d")
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Data of ${game_id} (compatdata) Try to move ${local_save_path} to remote share."
move_steam_game_dir "$(basename "${steam_dir}")" "$(dirname "${steam_dir}")" move_steam_game_dir "$(basename "${steam_dir}")" "$(dirname "${steam_dir}")"
;; ;;
## Data doesn't exist ## Data doesn't exist