mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-12-21 07:11:52 +01:00
added check for shortcuts
This commit is contained in:
parent
a9a76f94be
commit
79947e5e12
@ -192,12 +192,16 @@ else:
|
||||
try:
|
||||
with open(shortcuts_file, 'rb') as file:
|
||||
shortcuts = vdf.binary_loads(file.read())
|
||||
# If the file is empty or does not contain the 'shortcuts' key, initialize an empty 'shortcuts' dictionary
|
||||
if not shortcuts or 'shortcuts' not in shortcuts:
|
||||
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
|
||||
with open(shortcuts_file, 'wb') as file:
|
||||
vdf.binary_dumps({'shortcuts': {}}, file)
|
||||
|
||||
|
||||
# Open the config.vdf file
|
||||
with open(f"{logged_in_home}/.steam/root/config/config.vdf", 'r') as file:
|
||||
config_data = vdf.load(file)
|
||||
|
Loading…
Reference in New Issue
Block a user