mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-11-20 16:19:19 +01:00
Update NSLGameScanner.py
This commit is contained in:
parent
18c637197b
commit
1f3dbea29b
@ -197,17 +197,13 @@ hero64 = ""
|
|||||||
shortcuts_file = f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf"
|
shortcuts_file = f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf"
|
||||||
|
|
||||||
# Check if the file exists and is not executable
|
# Check if the file exists and is not executable
|
||||||
if os.path.exists(shortcuts_file):
|
if os.path.exists(shortcuts_file) and not os.access(shortcuts_file, os.X_OK):
|
||||||
# Check if the file is not executable
|
print("The file exists but is not executable. Writing empty shortcuts.")
|
||||||
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)
|
|
||||||
# Write {'shortcuts': {}} to the file
|
# Write {'shortcuts': {}} to the file
|
||||||
with open(shortcuts_file, 'wb') as file:
|
with open(shortcuts_file, 'wb') as file:
|
||||||
file.write(vdf.binary_dumps({'shortcuts': {}}))
|
file.write(vdf.binary_dumps({'shortcuts': {}}))
|
||||||
shortcuts = {'shortcuts': {}}
|
shortcuts = {'shortcuts': {}}
|
||||||
else:
|
elif os.path.exists(shortcuts_file):
|
||||||
# Load the existing shortcuts
|
# Load the existing shortcuts
|
||||||
with open(shortcuts_file, 'rb') as file:
|
with open(shortcuts_file, 'rb') as file:
|
||||||
try:
|
try:
|
||||||
@ -215,6 +211,9 @@ else:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error reading file: {e}")
|
print(f"Error reading file: {e}")
|
||||||
shortcuts = {}
|
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
|
# Check if the 'shortcuts' key is in the loaded data
|
||||||
|
Loading…
Reference in New Issue
Block a user