mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2025-02-01 19:32:37 +01:00
Add files via upload
This commit is contained in:
parent
82013748be
commit
4724966988
@ -542,162 +542,12 @@ for custom_website in custom_websites:
|
|||||||
#End of Creating Launcher Shortcuts
|
#End of Creating Launcher Shortcuts
|
||||||
|
|
||||||
|
|
||||||
#Custom Shortcut for NSL
|
|
||||||
# Define the parameters for the new shortcut
|
|
||||||
nslshortcutdirectory = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\""
|
|
||||||
nslappname = "NonSteamLaunchers"
|
|
||||||
nsllaunchoptions = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\" %command%"
|
|
||||||
nslstartingdir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/\""
|
|
||||||
print(f"nslshortcutdirectory: {nslshortcutdirectory}") # Debug print
|
|
||||||
print(f"nslappname: {nslappname}") # Debug print
|
|
||||||
print(f"nsllaunchoptions: {nsllaunchoptions}") # Debug print
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if separate_appids is set to 'false'
|
|
||||||
if separate_appids == 'false':
|
|
||||||
print("separate_appids is set to 'false'. Creating new shortcut...") # Debug print
|
|
||||||
# Call the function to create the new shortcut and store the returned appid
|
|
||||||
appid = create_new_entry(nslshortcutdirectory, nslappname, nsllaunchoptions, nslstartingdir)
|
|
||||||
app_ids[nslappname] = appid
|
|
||||||
print(f"appid: {appid}") # Debug print
|
|
||||||
else:
|
|
||||||
print("separate_appids is not set to 'false'. Skipping shortcut creation.") # Debug print
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Iterate over each launcher in the app_ids dictionary
|
|
||||||
for launcher_name, appid in app_ids.items():
|
|
||||||
print(f"The app ID for {launcher_name} is {appid}")
|
|
||||||
|
|
||||||
# Get the app ID for the first launcher that the user chose to install
|
|
||||||
if app_ids:
|
|
||||||
appid = app_ids.get(launcher_name)
|
|
||||||
print(f"App ID for the chosen launcher: {appid}")
|
|
||||||
|
|
||||||
# Create User Friendly Symlinks for the launchers
|
|
||||||
# Define the path to the compatdata directory
|
|
||||||
compatdata_dir = f'{logged_in_home}/.local/share/Steam/steamapps/compatdata'
|
|
||||||
print(f"Compatdata directory: {compatdata_dir}")
|
|
||||||
|
|
||||||
# Define a dictionary of original folder names
|
|
||||||
folder_names = {
|
|
||||||
'Epic Games': 'EpicGamesLauncher',
|
|
||||||
'Gog Galaxy': 'GogGalaxyLauncher',
|
|
||||||
'Ubisoft Connect': 'UplayLauncher',
|
|
||||||
'Battle.net': 'Battle.netLauncher',
|
|
||||||
'EA App': 'TheEAappLauncher',
|
|
||||||
'Amazon Games': 'AmazonGamesLauncher',
|
|
||||||
'itch.io': 'itchioLauncher',
|
|
||||||
'Legacy Games': 'LegacyGamesLauncher',
|
|
||||||
'Humble Bundle': 'HumbleGamesLauncher',
|
|
||||||
'IndieGala Client': 'IndieGalaLauncher',
|
|
||||||
'Rockstar Games Launcher': 'RockstarGamesLauncher',
|
|
||||||
'Glyph': 'GlyphLauncher',
|
|
||||||
'Playstation Plus': 'PlaystationPlusLauncher',
|
|
||||||
'VK Play': 'VKPlayLauncher',
|
|
||||||
'HoYoPlay': 'HoYoPlayLauncher',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Iterate over each launcher in the folder_names dictionary
|
|
||||||
for launcher_name, folder in folder_names.items():
|
|
||||||
# Define the current path of the folder
|
|
||||||
current_path = os.path.join(compatdata_dir, folder)
|
|
||||||
print(f"Current path for {launcher_name}: {current_path}")
|
|
||||||
|
|
||||||
# Check if the folder exists
|
|
||||||
if os.path.exists(current_path):
|
|
||||||
print(f'{launcher_name}: {folder} exists')
|
|
||||||
# Get the app ID for this launcher from the app_id_to_name dictionary
|
|
||||||
appid = app_ids.get(launcher_name)
|
|
||||||
print(f"App ID for {launcher_name}: {appid}")
|
|
||||||
|
|
||||||
# If appid is not None, proceed with renaming and symlink creation
|
|
||||||
if appid is not None:
|
|
||||||
# Define the new path of the folder
|
|
||||||
new_path = os.path.join(compatdata_dir, str(appid))
|
|
||||||
print(f"New path for {launcher_name}: {new_path}")
|
|
||||||
|
|
||||||
# Check if the new path already exists
|
|
||||||
if os.path.exists(new_path):
|
|
||||||
print(f'{new_path} already exists. Skipping renaming and symlinking.')
|
|
||||||
else:
|
|
||||||
# Rename the folder
|
|
||||||
os.rename(current_path, new_path)
|
|
||||||
print(f"Renamed {current_path} to {new_path}")
|
|
||||||
|
|
||||||
# Define the path of the symbolic link
|
|
||||||
symlink_path = os.path.join(compatdata_dir, folder)
|
|
||||||
print(f"Symlink path for {launcher_name}: {symlink_path}")
|
|
||||||
|
|
||||||
# Create a symbolic link to the renamed folder
|
|
||||||
os.symlink(new_path, symlink_path)
|
|
||||||
print(f"Created symlink at {symlink_path} to {new_path}")
|
|
||||||
else:
|
|
||||||
print(f'App ID for {launcher_name} is not available yet.')
|
|
||||||
else:
|
|
||||||
print(f'{launcher_name}: {folder} does not exist')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define the appid for the custom shortcut
|
|
||||||
custom_app_id = 4206469918
|
|
||||||
print(f"App ID for the custom shortcut: {custom_app_id}")
|
|
||||||
|
|
||||||
# Check if the NonSteamLaunchers folder exists
|
|
||||||
non_steam_launchers_path = os.path.join(compatdata_dir, 'NonSteamLaunchers')
|
|
||||||
if os.path.exists(non_steam_launchers_path):
|
|
||||||
print("NonSteamLaunchers already exists at the expected path.")
|
|
||||||
|
|
||||||
# Define the current path of the NonSteamLaunchers folder
|
|
||||||
current_path = os.path.join(compatdata_dir, 'NonSteamLaunchers')
|
|
||||||
print(f"Current path for NonSteamLaunchers: {current_path}")
|
|
||||||
|
|
||||||
# Check if NonSteamLaunchers is already a symbolic link
|
|
||||||
if os.path.islink(current_path):
|
|
||||||
print('NonSteamLaunchers is already a symbolic link')
|
|
||||||
# Check if NonSteamLaunchers is a symlink to an appid folder
|
|
||||||
if os.readlink(current_path) != os.path.join(compatdata_dir, str(custom_app_id)):
|
|
||||||
print('NonSteamLaunchers is symlinked to a different folder')
|
|
||||||
# Remove the existing symbolic link
|
|
||||||
os.unlink(current_path)
|
|
||||||
print(f'Removed existing symlink at {current_path}')
|
|
||||||
# Create a symbolic link to the correct appid folder
|
|
||||||
os.symlink(os.path.join(compatdata_dir, str(custom_app_id)), current_path)
|
|
||||||
print(f'Created new symlink at {current_path} to {os.path.join(compatdata_dir, str(custom_app_id))}')
|
|
||||||
else:
|
|
||||||
print('NonSteamLaunchers is already correctly symlinked')
|
|
||||||
else:
|
|
||||||
print("NonSteamLaunchers is not a symbolic link.")
|
|
||||||
# Check if the current path exists
|
|
||||||
if os.path.exists(current_path):
|
|
||||||
print("NonSteamLaunchers exists at the current path.")
|
|
||||||
# Define the new path of the NonSteamLaunchers folder
|
|
||||||
new_path = os.path.join(compatdata_dir, str(custom_app_id))
|
|
||||||
print(f"New path for NonSteamLaunchers: {new_path}")
|
|
||||||
|
|
||||||
# Check if the new path already exists
|
|
||||||
if os.path.exists(new_path):
|
|
||||||
print(f'{new_path} already exists. Skipping renaming and symlinking.')
|
|
||||||
else:
|
|
||||||
# Move the NonSteamLaunchers folder to the new path
|
|
||||||
shutil.move(current_path, new_path)
|
|
||||||
print(f"Moved NonSteamLaunchers folder to {new_path}")
|
|
||||||
|
|
||||||
# Define the path of the symbolic link
|
|
||||||
symlink_path = os.path.join(compatdata_dir, 'NonSteamLaunchers')
|
|
||||||
|
|
||||||
# Create a symbolic link to the renamed NonSteamLaunchers folder
|
|
||||||
os.symlink(new_path, symlink_path)
|
|
||||||
print(f"Created symlink at {symlink_path} to {new_path}")
|
|
||||||
else:
|
|
||||||
print(f"The directory {current_path} does not exist. Skipping.")
|
|
||||||
|
|
||||||
|
|
||||||
#End of old refactored Code
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user