xdg: also try to symlink for unknown type
This commit is contained in:
parent
218d7a6523
commit
5fb5532178
|
@ -101,8 +101,10 @@ symlink_game_dir() {
|
|||
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 game — Symlink remote data of ${_game_name} to local storage."
|
||||
return 0
|
||||
else
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Symlink game — ${_game_name} doesn't have remote data."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
@ -142,7 +144,7 @@ done
|
|||
IFS="%"
|
||||
for game_name in ${xdg_config_games}; do
|
||||
local_game_path="${HOME}/${xdg_config}/${game_name}"
|
||||
local_game_path_type="$(ls -ld "${local_game_path}" | sed 's/\(^.\).*/\1/')"
|
||||
local_game_path_type="$(ls -ld "${local_game_path}" 2> /dev/null | sed 's/\(^.\).*/\1/')"
|
||||
|
||||
case ${local_game_path_type} in
|
||||
## Data is already a symlink
|
||||
|
@ -161,8 +163,13 @@ for game_name in ${xdg_config_games}; do
|
|||
;;
|
||||
## Data can't be managed
|
||||
*)
|
||||
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_name} (XDG CONFIG) − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
|
||||
exit 3
|
||||
### Still try to symlink the savegame directory
|
||||
symlink_game_dir "${game_name}" "${xdg_config}"
|
||||
### If the symlink failed
|
||||
if [ "${?}" != 0 ]; then
|
||||
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_name} (XDG CONFIG) − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -173,7 +180,7 @@ done
|
|||
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/')"
|
||||
local_game_path_type="$(ls -ld "${local_game_path}" 2> /dev/null | sed 's/\(^.\).*/\1/')"
|
||||
|
||||
case ${local_game_path_type} in
|
||||
## Data is already a symlink
|
||||
|
@ -192,8 +199,13 @@ for game_name in ${xdg_data_games}; do
|
|||
;;
|
||||
## Data can't be managed
|
||||
*)
|
||||
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_name} (XDG DATA) − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
|
||||
exit 3
|
||||
### Still try to symlink the savegame directory
|
||||
symlink_game_dir "${game_name}" "${xdg_data}"
|
||||
### If the symlink failed
|
||||
if [ "${?}" != 0 ]; then
|
||||
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_name} (XDG DATA) − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in New Issue