diff --git a/backend/decky_loader/browser.py b/backend/decky_loader/browser.py index af23ed0c..587b5271 100644 --- a/backend/decky_loader/browser.py +++ b/backend/decky_loader/browser.py @@ -157,8 +157,16 @@ async def _install(self, artifact: str, name: str, version: str, hash: str): # Will be set later in code res_zip = None - # Check if plugin is installed + # Check if plugin was already installed before this isInstalled = False + + try: + pluginFolderPath = self.find_plugin_folder(name) + if pluginFolderPath: + isInstalled = True + except: + logger.error(f"Failed to determine if {name} is already installed, continuing anyway.") + # Preserve plugin order before removing plugin (uninstall alters the order and removes the plugin from the list) current_plugin_order = self.settings.getSetting("pluginOrder")[:] if self.loader.watcher: @@ -215,13 +223,6 @@ async def _install(self, artifact: str, name: str, version: str, hash: str): else: name = sub(r"/.+$", "", plugin_json_list[0]) - try: - pluginFolderPath = self.find_plugin_folder(name) - if pluginFolderPath: - isInstalled = True - except: - logger.error(f"Failed to determine if {name} is already installed, continuing anyway.") - # Check to make sure we got the file if res_zip is None: logger.fatal(f"Could not fetch {artifact}")