From cc1473e28cf51557e26d2cfd66ee695eb30634ce Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 8 Oct 2019 00:08:15 +0200 Subject: [PATCH] Display the list of unknown directories --- games/save.game.steam | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/games/save.game.steam b/games/save.game.steam index 0d7a584..968997e 100755 --- a/games/save.game.steam +++ b/games/save.game.steam @@ -15,7 +15,7 @@ ## 2. If a directory doesn't exist, check if a remote one is ## available and symlink it. ## -## TODO : 3. List directories without symlinks. +## 3. List directories without symlinks. ## ## KISS : Only manage save directories from Steam userdata. For other ## paths ($XDG_DATA_HOME,…) check other scripts. @@ -42,6 +42,7 @@ steam_userdata=".steam/steam/userdata/${steam_id}" steam_games="760 35700 35720 204360 206420 218820 247080 255870 312530 359840" ## }}} ## Ids without backups in userdata {{{ +### 7 − Unknown ### 620 − Portal 2 − https://pcgamingwiki.com/wiki/Portal_2 ### 49520 − Borderlands 2 − https://pcgamingwiki.com/wiki/Borderlands_2 ### 55230 − Saints Row: The Third − https://pcgamingwiki.com/wiki/Saints_Row:_The_Third @@ -61,6 +62,7 @@ steam_games="760 35700 35720 204360 206420 218820 247080 255870 312530 359840" ### 686200 − Door Kickers: Action Squad − https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad ### 697660 − Jump Gunners − https://pcgamingwiki.com/wiki/Jump_Gunners ### 728880 − Overcooked! 2 − https://pcgamingwiki.com/wiki/Overcooked!_2 +ignore_pattern_steam_id="(7|620|49520|55230|213670|219150|241100|242680|251470|255870|268990|274190|295790|416600|474210|480490|686200|697660|728880|config|ugc|ugcmsgcache|\.)$" ## }}} ## }}} @@ -68,6 +70,8 @@ remote_dir="${HOME}/Nextcloud/games/linux.sgl.script" remote_steam_userdata="${remote_dir}/${steam_userdata}" local_steam_userdata="${HOME}/${steam_userdata}" + +local_unmanaged_games_list="/tmp/unmanaged_games_list" # }}} # Functions {{{ @@ -138,7 +142,7 @@ for game_id in ${steam_games}; do ## Data is already a symlink "symbolic") [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam for loop — The data of ${game_id} are already symlinked to .... Skip." - ;; + ;; ## Data is still a directory "directory") move_steam_game_dir "${game_id}" @@ -156,3 +160,17 @@ for game_id in ${steam_games}; do done # }}} +# List unmanage game id {{{ +cd -- "${local_steam_userdata}" || exit 1 +rm -f -- "${local_unmanaged_games_list}" +printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort" +find . -maxdepth 1 -type d | grep -vE "${ignore_pattern_steam_id}" > "${local_unmanaged_games_list}" +if [ -s "${local_unmanaged_games_list}" ]; then + printf '\e[1;35m%-6s\e[m\n' "List of unmanaged directories :" + cat "${local_unmanaged_games_list}" +fi +rm -f -- "${local_unmanaged_games_list}" +cd -- - > /dev/null || exit 1 +# }}} + +exit 0