Update NSLGameScanner.py

This commit is contained in:
Roy 2024-06-22 11:23:02 -07:00 committed by GitHub
parent 1f3dbea29b
commit b6d7b71c03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,34 +193,10 @@ grid64 = ""
logo64 = ""
hero64 = ""
# Define the path to the shortcuts file
shortcuts_file = f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf"
# Check if the file exists and is not executable
if os.path.exists(shortcuts_file) and not os.access(shortcuts_file, os.X_OK):
print("The file exists but is not executable. Writing empty shortcuts.")
# Write {'shortcuts': {}} to the file
with open(shortcuts_file, 'wb') as file:
file.write(vdf.binary_dumps({'shortcuts': {}}))
shortcuts = {'shortcuts': {}}
elif os.path.exists(shortcuts_file):
# Load the existing shortcuts
with open(shortcuts_file, 'rb') as file:
try:
# Load the existing shortcuts
with open(f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf", 'rb') as file:
shortcuts = vdf.binary_loads(file.read())
except Exception as e:
print(f"Error reading file: {e}")
shortcuts = {}
else:
print("The file does not exist. Creating an empty shortcuts dictionary.")
shortcuts = {'shortcuts': {}}
# Check if the 'shortcuts' key is in the loaded data
if 'shortcuts' not in shortcuts:
print("The file does not contain the 'shortcuts' key.")
shortcuts = {'shortcuts': {}}
# Open the config.vdf file
with open(f"{logged_in_home}/.steam/root/config/config.vdf", 'r') as file: