fixed steam id check

~Steam id to steamid3  for user data
This commit is contained in:
Roy 2023-05-26 01:15:12 -07:00 committed by GitHub
parent 9d6874c559
commit 88f3e6ffa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ chmod +x "$0"
set -x set -x
version=v2.71 version=v2.75
check_for_updates() { check_for_updates() {
# Set the URL to the GitHub API for the repository # Set the URL to the GitHub API for the repository
@ -2054,10 +2054,6 @@ fi
#VDF Library #VDF Library
# Set the download directory # Set the download directory
@ -2120,33 +2116,28 @@ python setup.py install --prefix=~/Downloads/NonSteamLaunchersInstallation
# Initialize the userdata_folder variable # Set the default Steam directory
userdata_folder="" steam_dir="$HOME/.local/share/Steam"
# Initialize the most_recent variable # Check if the config.vdf file exists
most_recent=0 if [[ -f "$steam_dir/config/config.vdf" ]]; then
# Get the steamid of the currently logged in user
steamid=$(grep -oP 'SteamID"\s+"\K[0-9]+' "$steam_dir/config/config.vdf")
# Loop through all the userdata folders # Convert steamid to steamid3
for USERDATA_FOLDER in ~/.steam/root/userdata/* steamid3=$((steamid - 76561197960265728))
do
# Check if the current userdata folder is not the "0" or "anonymous" folder
if [[ "$USERDATA_FOLDER" != *"/0" ]] && [[ "$USERDATA_FOLDER" != *"/anonymous" ]]
then
# Get the access time of the current userdata folder
access_time=$(stat -c %X "$USERDATA_FOLDER")
# Check if the access time of the current userdata folder is more recent than the most recent access time # Check if the userdata directory exists for the currently logged in user
if [[ $access_time -gt $most_recent ]] if [[ -d "$HOME/.steam/root/userdata/$steamid3" ]]; then
then echo "The correct steamid3 for the currently logged in user is: $steamid3"
# The access time of the current userdata folder is more recent userdata_folder="$HOME/.steam/root/userdata/$steamid3"
# Set the userdata_folder variable echo "The corresponding userdata folder for the currently logged in user is: $userdata_folder"
userdata_folder="$USERDATA_FOLDER" else
echo "Could not find userdata directory for steamid3: $steamid3"
# Update the most_recent variable
most_recent=$access_time
fi fi
else
echo "Could not find config.vdf file"
fi fi
done
# Check if the userdata folder was found # Check if the userdata folder was found
if [[ -n "$userdata_folder" ]]; then if [[ -n "$userdata_folder" ]]; then
@ -2190,6 +2181,8 @@ fi
# Delete NonSteamLaunchersInstallation subfolder in Downloads folder # Delete NonSteamLaunchersInstallation subfolder in Downloads folder
rm -rf ~/Downloads/NonSteamLaunchersInstallation rm -rf ~/Downloads/NonSteamLaunchersInstallation
@ -2198,7 +2191,12 @@ rm -rf ~/Downloads/NonSteamLaunchersInstallation
nohup sh -c 'sleep 10; /usr/bin/steam' & nohup sh -c 'sleep 10; /usr/bin/steam' &
# Close all instances of Steam # Close all instances of Steam
killall steam & killall steam
@ -2885,4 +2883,3 @@ with open('$shortcuts_vdf_path', 'wb') as f: