Skip to content

Commit

Permalink
Update NSLGameScanner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Jun 22, 2024
1 parent 18c6371 commit 1f3dbea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions NSLGameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,23 @@ def get_unsigned_shortcut_id(signed_shortcut_id):
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):
# Check if the file is not executable
if not os.access(shortcuts_file, os.X_OK):
print("The file exists but is not executable. Making it executable.")
# Set the file permissions to 755
os.chmod(shortcuts_file, 0o755)
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': {}}
else:
elif os.path.exists(shortcuts_file):
# Load the existing shortcuts
with open(shortcuts_file, 'rb') as file:
try:
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
Expand Down

0 comments on commit 1f3dbea

Please sign in to comment.