From 53c2b43b21d27a65509f153218ce276a66de2cb9 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 19 May 2024 00:14:49 -0700 Subject: [PATCH] Add files via upload --- NonSteamLaunchers.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index ac672e0..ec483da 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -2329,30 +2329,31 @@ export PYTHONPATH="${download_dir}/lib/python${python_version}/site-packages/:$P # Set the default Steam directory steam_dir="${logged_in_home}/.local/share/Steam" -# Check if the loginusers.vdf file exists in the original directory -if [[ -f "${logged_in_home}/.steam/root/config/loginusers.vdf" ]]; then +# Check if the loginusers.vdf file exists in either of the two directories +if [[ -f "${logged_in_home}/.steam/root/config/loginusers.vdf" ]] || [[ -f "/home/deck/.local/share/Steam/config/loginusers.vdf" ]]; then + if [[ -f "${logged_in_home}/.steam/root/config/loginusers.vdf" ]]; then + file_path="${logged_in_home}/.steam/root/config/loginusers.vdf" + else + file_path="/home/deck/.local/share/Steam/config/loginusers.vdf" + fi + # Extract the block of text for the most recent user - most_recent_user=$(sed -n '/"users"/,/"MostRecent" "1"/p' "${logged_in_home}/.steam/root/config/loginusers.vdf") -elif [[ -f "${logged_in_home}/.local/share/Steam/config/loginusers.vdf" ]]; then - # If the file is not in the original directory, check the additional directory - most_recent_user=$(sed -n '/"users"/,/"MostRecent" "1"/p' "${logged_in_home}/.local/share/Steam/config/loginusers.vdf") -fi - - # Initialize variables - max_timestamp=0 - current_user="" - current_steamid="" + most_recent_user=$(sed -n '/"users"/,/"MostRecent" "1"/p' "$file_path") + # Initialize variables + max_timestamp=0 + current_user="" + current_steamid="" # Process each user block - # Set IFS to only look for Commas to avoid issues with Whitespace in older account names. + # Set IFS to only look for Commas to avoid issues with Whitespace in older account names. while IFS="," read steamid account timestamp; do if (( timestamp > max_timestamp )); then max_timestamp=$timestamp current_user=$account current_steamid=$steamid fi - # Output our discovered values as comma seperated string to be read into the IDs. + # Output our discovered values as comma seperated string to be read into the IDs. done < <(echo "$most_recent_user" | awk -v RS='}\n' -F'\n' ' { for(i=1;i<=NF;i++){ @@ -2398,6 +2399,7 @@ fi + # Check if userdata folder was found if [[ -n "$userdata_folder" ]]; then # Userdata folder was found