mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2025-02-01 11:22:37 +01:00
Update NSLGameScanner.py
This commit is contained in:
parent
1f4510608f
commit
2e5e8673e3
@ -365,6 +365,7 @@ def is_match(name1, name2):
|
|||||||
|
|
||||||
# Add or update the proton compatibility settings
|
# Add or update the proton compatibility settings
|
||||||
|
|
||||||
|
|
||||||
def add_compat_tool(app_id, launchoptions):
|
def add_compat_tool(app_id, launchoptions):
|
||||||
if 'CompatToolMapping' not in config_data['InstallConfigStore']['Software']['Valve']['Steam']:
|
if 'CompatToolMapping' not in config_data['InstallConfigStore']['Software']['Valve']['Steam']:
|
||||||
config_data['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'] = {}
|
config_data['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping'] = {}
|
||||||
@ -392,8 +393,9 @@ def add_compat_tool(app_id, launchoptions):
|
|||||||
return compat_tool_name
|
return compat_tool_name
|
||||||
|
|
||||||
|
|
||||||
|
# Check if the shortcut already exists in the shortcuts
|
||||||
def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, launch_options):
|
def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, launch_options):
|
||||||
# Check if the game already exists in the shortcuts using the id
|
# Check if the game already exists in the shortcuts using the ID
|
||||||
if any(s.get('appid') == shortcut_id for s in shortcuts['shortcuts'].values()):
|
if any(s.get('appid') == shortcut_id for s in shortcuts['shortcuts'].values()):
|
||||||
print(f"Existing shortcut found based on shortcut ID for game {display_name}. Skipping creation.")
|
print(f"Existing shortcut found based on shortcut ID for game {display_name}. Skipping creation.")
|
||||||
return True
|
return True
|
||||||
@ -404,12 +406,10 @@ def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, lau
|
|||||||
if any(s.get('AppName') == display_name and s.get('Exe') == exe_path and s.get('StartDir') == start_dir and s.get('LaunchOptions') == launch_options for s in shortcuts['shortcuts'].values()):
|
if any(s.get('AppName') == display_name and s.get('Exe') == exe_path and s.get('StartDir') == start_dir and s.get('LaunchOptions') == launch_options for s in shortcuts['shortcuts'].values()):
|
||||||
print(f"Existing shortcut found based on matching fields for game {display_name}. Skipping creation.")
|
print(f"Existing shortcut found based on matching fields for game {display_name}. Skipping creation.")
|
||||||
return True
|
return True
|
||||||
#End of Code
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# Start of Refactoring code from the .sh file
|
||||||
|
|
||||||
#Start of Refactoring code from the .sh file
|
|
||||||
sys.path.insert(0, os.path.expanduser(f"{logged_in_home}/Downloads/NonSteamLaunchersInstallation/lib/python{python_version}/site-packages"))
|
sys.path.insert(0, os.path.expanduser(f"{logged_in_home}/Downloads/NonSteamLaunchersInstallation/lib/python{python_version}/site-packages"))
|
||||||
print(sys.path)
|
print(sys.path)
|
||||||
|
|
||||||
@ -417,12 +417,15 @@ print(sys.path)
|
|||||||
# Create an empty dictionary to store the app IDs
|
# Create an empty dictionary to store the app IDs
|
||||||
app_ids = {}
|
app_ids = {}
|
||||||
|
|
||||||
|
# Get the next available key for the shortcuts
|
||||||
def get_next_available_key(shortcuts):
|
def get_next_available_key(shortcuts):
|
||||||
key = 0
|
key = 0
|
||||||
while str(key) in shortcuts['shortcuts']:
|
while str(key) in shortcuts['shortcuts']:
|
||||||
key += 1
|
key += 1
|
||||||
return str(key)
|
return str(key)
|
||||||
|
|
||||||
|
|
||||||
|
# Create a new entry for a game shortcut
|
||||||
def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir):
|
def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir):
|
||||||
global new_shortcuts_added
|
global new_shortcuts_added
|
||||||
global shortcuts_updated
|
global shortcuts_updated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user