Skip to content

Commit

Permalink
move check for if plugin was installed to the start of the function (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
PartyWumpus authored Oct 13, 2024
1 parent 8d2b252 commit 4c95484
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions backend/decky_loader/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -227,13 +235,6 @@ async def _install(self, artifact: str, name: str, version: str, hash: str):
except Exception as e:
logger.error(f"Failed to read or parse {plugin_json_file}: {str(e)}. Falling back to extracting from path.")

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}")
Expand Down

0 comments on commit 4c95484

Please sign in to comment.