mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-12-30 11:41:50 +01:00
error handling for vdf
This commit is contained in:
parent
4f77e05dfb
commit
cc2b4053ea
@ -197,9 +197,15 @@ else:
|
||||
shortcuts = {'shortcuts': {}}
|
||||
except Exception as e:
|
||||
print(f"Error reading shortcuts file: {e}")
|
||||
# If an error occurs when reading the file, create a new file with an empty "shortcuts" section
|
||||
print("Please check the file and try again.")
|
||||
return
|
||||
|
||||
# Check data integrity before writing to file
|
||||
if shortcuts and isinstance(shortcuts, dict) and 'shortcuts' in shortcuts:
|
||||
with open(shortcuts_file, 'wb') as file:
|
||||
vdf.binary_dumps({'shortcuts': {}}, file)
|
||||
vdf.binary_dumps(shortcuts, file)
|
||||
else:
|
||||
print("The data to be written to the shortcuts file is not valid.")
|
||||
|
||||
|
||||
# Open the config.vdf file
|
||||
|
Loading…
Reference in New Issue
Block a user