Add loop to manage XDG_DATA content
This commit is contained in:
parent
91b5e874ed
commit
eb504358f4
|
@ -57,7 +57,7 @@ xdg_data="$(printf "%s" "${XDG_DATA_HOME}" | sed -e "s;${HOME}/;;")"
|
|||
### Saints Row IV − vpltd − https://pcgamingwiki.com/wiki/Saints_Row_IV
|
||||
### The Dishwasher: Vampire Smile − VampireSmile − https://pcgamingwiki.com/wiki/The_Dishwasher:_Vampire_Smile
|
||||
### TowerFall Ascension − TowerFall − https://pcgamingwiki.com/wiki/TowerFall_Ascension
|
||||
data_games="aspyr-media%Cellar Door Games%HotlineMiami%Tribute Games%PJShooter%vpltd%VampireSmile%TowerFall"
|
||||
xdg_data_games="aspyr-media%Cellar Door Games%HotlineMiami%Tribute Games%PJShooter%vpltd%VampireSmile%TowerFall"
|
||||
### }}}
|
||||
|
||||
## }}}
|
||||
|
@ -164,3 +164,36 @@ for game_name in ${xdg_config_games}; do
|
|||
|
||||
done
|
||||
# }}}
|
||||
# Manage XDG data save game {{{
|
||||
## Set "%" as field separator
|
||||
IFS="%"
|
||||
for game_name in ${xdg_data_games}; do
|
||||
local_game_path="${HOME}/${xdg_data}/${game_name}"
|
||||
local_game_path_type="$(ls -ld "${local_game_path}" | sed 's/\(^.\).*/\1/')"
|
||||
|
||||
case ${local_game_path_type} in
|
||||
## Data is already a symlink
|
||||
"symbolic"|"l")
|
||||
link_name="$(file "${local_game_path}" | sed 's;.* symbolic link to \(.*\);\1;')"
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : XDG DATA for loop — The data of ${game_name} are already symlinked to ${link_name} . Skip."
|
||||
;;
|
||||
## Data is still a directory
|
||||
"directory"|"d")
|
||||
move_game_dir "${game_name}" "${xdg_data}"
|
||||
;;
|
||||
## Data doesn't exist
|
||||
"cannot")
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : XDG DATA for loop — The data of ${game_name} − ${local_game_path} doesn't exist. Skip."
|
||||
symlink_game_dir "${game_name}" "${xdg_data}"
|
||||
;;
|
||||
## Data can't be managed
|
||||
*)
|
||||
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_name} (userdata) − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
# }}}
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue