Add files via upload

This commit is contained in:
Roy 2025-02-18 03:06:25 -08:00 committed by GitHub
parent c1cccbd2f7
commit f2f53a933b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,6 +76,7 @@ legacy_launcher = os.environ.get('legacy_launcher', '')
vkplay_launcher = os.environ.get('vkplay_launcher', '') vkplay_launcher = os.environ.get('vkplay_launcher', '')
hoyoplay_launcher = os.environ.get('hoyoplay_launcher', '') hoyoplay_launcher = os.environ.get('hoyoplay_launcher', '')
gamejolt_launcher = os.environ.get('gamejolt_launcher', '') gamejolt_launcher = os.environ.get('gamejolt_launcher', '')
minecraft_launcher = os.environ.get('minecraft_launcher', '')
#Variables of the Launchers #Variables of the Launchers
# Define the path of the Launchers # Define the path of the Launchers
@ -1827,6 +1828,67 @@ else:
#Minecraft Legacy Launcher Scanner
# Path to the JSON file
file_path = f"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{minecraft_launcher}/pfx/drive_c/users/deck/AppData/Roaming/.minecraft/launcher_settings.json"
# Function to convert Windows path to Unix path dynamically
def convert_to_unix_path(windows_path, home_dir):
unix_path = windows_path.replace('\\', '/')
if len(windows_path) > 2 and windows_path[1] == ":":
unix_path = unix_path[2:]
unix_path = os.path.join(home_dir, unix_path.lstrip('/'))
return unix_path
# Check if the JSON file exists
if os.path.exists(file_path):
try:
with open(file_path, 'r') as file:
# Parse the JSON data
data = json.load(file)
# Extract the productLibraryDir
product_library_dir = data.get('productLibraryDir')
if product_library_dir:
home_dir = os.path.expanduser("~")
unix_product_library_dir = convert_to_unix_path(product_library_dir, home_dir)
# Define the target file path
target_file = os.path.join(unix_product_library_dir, 'dungeons', 'dungeons', 'Dungeons.exe')
# Check if the file exists
if os.path.exists(target_file):
print(f"File exists: {target_file}")
else:
print(f"File does not exist: {target_file}")
# Set the display name to the game shortcut name from the JSON
display_name = "Minecraft Dungeons"
launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{minecraft_launcher}/\" %command%"
exe_path = f"\"{target_file}\""
start_dir = f"\"{os.path.dirname(target_file)}\""
# Create the new entry (this is where you can use your custom function for Steam shortcuts)
create_new_entry(exe_path, display_name, launch_options, start_dir)
else:
print("Key 'productLibraryDir' not found in the JSON.")
except json.JSONDecodeError:
print("Error decoding the JSON file.")
else:
print("Skipping Minecraft Legacy Launcher Scanner")
# End of the Minecraft Legacy Launcher
# Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed # Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed
# Function to send a notification with an optional icon # Function to send a notification with an optional icon