mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2024-11-20 16:19:19 +01:00
removed check
This commit is contained in:
parent
c50461d2e0
commit
f34088d4ae
@ -914,31 +914,25 @@ if not os.path.exists(PIPE_PATH):
|
|||||||
# Create the named pipe
|
# Create the named pipe
|
||||||
os.mkfifo(PIPE_PATH)
|
os.mkfifo(PIPE_PATH)
|
||||||
|
|
||||||
# Define the directory path
|
# Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed
|
||||||
dir_path = f"{logged_in_home}/homebrew/plugins/NonSteamLaunchers/"
|
if new_shortcuts_added or shortcuts_updated:
|
||||||
|
print(f"Saving new config and shortcuts files")
|
||||||
|
conf = vdf.dumps(config_data, pretty=True)
|
||||||
|
with open(f"{logged_in_home}/.steam/root/config/config.vdf", 'w') as file:
|
||||||
|
file.write(conf)
|
||||||
|
with open(f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf", 'wb') as file:
|
||||||
|
file.write(vdf.binary_dumps(shortcuts))
|
||||||
|
|
||||||
# Check if the directory exists
|
# Load the configset_controller_neptune.vdf file
|
||||||
if not os.path.exists(dir_path):
|
with open(controller_config_path, 'r') as f:
|
||||||
# Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed
|
config = vdf.load(f)
|
||||||
if new_shortcuts_added or shortcuts_updated:
|
|
||||||
print(f"Saving new config and shortcuts files")
|
|
||||||
conf = vdf.dumps(config_data, pretty=True)
|
|
||||||
with open(f"{logged_in_home}/.steam/root/config/config.vdf", 'w') as file:
|
|
||||||
file.write(conf)
|
|
||||||
with open(f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/shortcuts.vdf", 'wb') as file:
|
|
||||||
file.write(vdf.binary_dumps(shortcuts))
|
|
||||||
|
|
||||||
# Load the configset_controller_neptune.vdf file
|
# Add new entries for the games
|
||||||
with open(controller_config_path, 'r') as f:
|
|
||||||
config = vdf.load(f)
|
|
||||||
|
|
||||||
# Add new entries for the games
|
|
||||||
for app_id in app_ids:
|
for app_id in app_ids:
|
||||||
config['controller_config'][str(app_id)] = {
|
config['controller_config'][str(app_id)] = {
|
||||||
'workshop': 'workshop_id'
|
'workshop': 'workshop_id'
|
||||||
}
|
}
|
||||||
|
# Add new entries for the installed launchers and games
|
||||||
# Add new entries for the installed launchers and games
|
|
||||||
config['controller_config']['epic games'] = {
|
config['controller_config']['epic games'] = {
|
||||||
'workshop': '2800178806'
|
'workshop': '2800178806'
|
||||||
}
|
}
|
||||||
@ -1016,36 +1010,38 @@ if not os.path.exists(dir_path):
|
|||||||
with open(controller_config_path, 'w') as f:
|
with open(controller_config_path, 'w') as f:
|
||||||
vdf.dump(config, f)
|
vdf.dump(config, f)
|
||||||
|
|
||||||
# Print the created shortcuts
|
# Print the created shortcuts
|
||||||
if created_shortcuts:
|
if created_shortcuts:
|
||||||
print("Created Shortcuts:")
|
print("Created Shortcuts:")
|
||||||
for name in created_shortcuts:
|
for name in created_shortcuts:
|
||||||
print(name)
|
print(name)
|
||||||
|
|
||||||
# Assuming 'games' is a list of game dictionaries
|
# Assuming 'games' is a list of game dictionaries
|
||||||
games = [shortcut for shortcut in shortcuts['shortcuts'].values()]
|
games = [shortcut for shortcut in shortcuts['shortcuts'].values()]
|
||||||
|
|
||||||
# Open the pipe for writing
|
# Open the pipe for writing
|
||||||
with open(PIPE_PATH, 'w') as pipe:
|
with open(PIPE_PATH, 'w') as pipe:
|
||||||
for game in games:
|
for game in games:
|
||||||
# Skip if 'appname' or 'exe' is None
|
# Skip if 'appname' or 'exe' is None
|
||||||
if game.get('appname') is None or game.get('exe') is None:
|
if game.get('appname') is None or game.get('exe') is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Create a dictionary to hold the shortcut information
|
# Create a dictionary to hold the shortcut information
|
||||||
shortcut_info = {
|
shortcut_info = {
|
||||||
'appid': str(game.get('appid')),
|
'appid': str(game.get('appid')),
|
||||||
'appname': game.get('appname'),
|
'appname': game.get('appname'),
|
||||||
'exe': game.get('exe'),
|
'exe': game.get('exe'),
|
||||||
'StartDir': game.get('StartDir'),
|
'StartDir': game.get('StartDir'),
|
||||||
'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}",
|
'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}",
|
||||||
'LaunchOptions': game.get('LaunchOptions'),
|
'LaunchOptions': game.get('LaunchOptions'),
|
||||||
'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined
|
'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print the shortcut information in JSON format
|
# Print the shortcut information in JSON format
|
||||||
message = json.dumps(shortcut_info)
|
message = json.dumps(shortcut_info)
|
||||||
print(message, flush=True) # Print to stdout
|
print(message, flush=True) # Print to stdout
|
||||||
pipe.write(message + '\n') # Write to the pipe
|
pipe.write(message + '\n') # Write to the pipe
|
||||||
|
|
||||||
print("All finished!")
|
print("All finished!")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user