Update NonSteamLaunchers.sh

~reverted
This commit is contained in:
Roy 2024-01-17 16:21:45 -08:00 committed by GitHub
parent 5df4da7ea7
commit faf6ed65e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2556,41 +2556,30 @@ steam_dir="${logged_in_home}/.local/share/Steam"
# Check if the loginusers.vdf file exists # Check if the loginusers.vdf file exists
if [[ -f "${logged_in_home}/.steam/root/config/loginusers.vdf" ]]; then if [[ -f "${logged_in_home}/.steam/root/config/loginusers.vdf" ]]; then
# Extract the blocks of text for all users # Extract the block of text for the most recent user
all_users=$(sed -n '/"users"/,/}/p' "${logged_in_home}/.steam/root/config/loginusers.vdf") most_recent_user=$(sed -n '/"users"/,/"MostRecent" "1"/p' "${logged_in_home}/.steam/root/config/loginusers.vdf")
# Initialize variables to store the most recent user's SteamID and timestamp # Extract the SteamIDs from the block of text for the most recent user
most_recent_steamid="" steamids=$(echo "$most_recent_user" | grep -o '[0-9]\{17\}')
most_recent_timestamp=0
# Loop over each user block # Loop over each SteamID
while read -r user_block; do for steamid in $steamids; do
# Extract the SteamID and timestamp from the user block # Convert steamid to steamid3
steamid=$(echo "$user_block" | grep -o '[0-9]\{17\}') steamid3=$((steamid - 76561197960265728))
timestamp=$(echo "$user_block" | grep -o '"Timestamp"[[:space:]]"[0-9]\+"' | grep -o '[0-9]\+')
# If this user's timestamp is more recent than the most recent timestamp so far, update the most recent SteamID and timestamp # Initialize the userdata_folder variable
if ((timestamp > most_recent_timestamp)); then userdata_folder=""
most_recent_steamid=$steamid
most_recent_timestamp=$timestamp # Directly map steamid3 to userdata folder
userdata_folder="/home/deck/.steam/root/userdata/${steamid3}"
# Check if userdata_folder exists
if [[ -d "$userdata_folder" ]]; then
echo "Found userdata folder for user with SteamID $steamid: $userdata_folder"
else
echo "Could not find userdata folder for user with SteamID $steamid"
fi fi
done < <(echo "$all_users" | awk '/{/,/}/') done
# Convert most_recent_steamid to steamid3
steamid3=$((most_recent_steamid - 76561197960265728))
# Initialize the userdata_folder variable
userdata_folder=""
# Directly map steamid3 to userdata folder
userdata_folder="/home/deck/.steam/root/userdata/${steamid3}"
# Check if userdata_folder exists
if [[ -d "$userdata_folder" ]]; then
echo "Found userdata folder for current user: $userdata_folder"
else
echo "Could not find userdata folder for current user"
fi
else else
echo "Could not find loginusers.vdf file" echo "Could not find loginusers.vdf file"
fi fi
@ -2598,6 +2587,8 @@ fi
# Check if userdata folder was found # Check if userdata folder was found
if [[ -n "$userdata_folder" ]]; then if [[ -n "$userdata_folder" ]]; then
# Userdata folder was found # Userdata folder was found