mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 11:22:03 +00:00
Get plugin name for development ZIP during installation (#578)
* fix: get plugin name for dev builds from ZIP (SteamDeckHomebrew/decky-loader#527) Signed-off-by: eXhumer <exhumer1@protonmail.com>
This commit is contained in:
+23
-6
@@ -10,6 +10,7 @@ from hashlib import sha256
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from os import R_OK, W_OK, path, listdir, access, mkdir
|
from os import R_OK, W_OK, path, listdir, access, mkdir
|
||||||
|
from re import sub
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from time import time
|
from time import time
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
@@ -162,12 +163,6 @@ class PluginBrowser:
|
|||||||
current_plugin_order = self.settings.getSetting("pluginOrder")[:]
|
current_plugin_order = self.settings.getSetting("pluginOrder")[:]
|
||||||
if self.loader.watcher:
|
if self.loader.watcher:
|
||||||
self.loader.watcher.disabled = True
|
self.loader.watcher.disabled = True
|
||||||
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 if the file is a local file or a URL
|
# Check if the file is a local file or a URL
|
||||||
if artifact.startswith("file://"):
|
if artifact.startswith("file://"):
|
||||||
@@ -198,6 +193,28 @@ class PluginBrowser:
|
|||||||
if res.status != 200:
|
if res.status != 200:
|
||||||
logger.error(f"Server did not accept install count increment request. code: {res.status}")
|
logger.error(f"Server did not accept install count increment request. code: {res.status}")
|
||||||
|
|
||||||
|
if res_zip and version == "dev":
|
||||||
|
with ZipFile(res_zip) as plugin_zip:
|
||||||
|
plugin_json_list = [file for file in plugin_zip.namelist() if file.endswith("/plugin.json") and file.count("/") == 1]
|
||||||
|
|
||||||
|
if len(plugin_json_list) == 0:
|
||||||
|
logger.fatal("No plugin.json found in plugin ZIP")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif len(plugin_json_list) > 1:
|
||||||
|
logger.fatal("Multiple plugin.json found in plugin ZIP")
|
||||||
|
return
|
||||||
|
|
||||||
|
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
|
# Check to make sure we got the file
|
||||||
if res_zip is None:
|
if res_zip is None:
|
||||||
logger.fatal(f"Could not fetch {artifact}")
|
logger.fatal(f"Could not fetch {artifact}")
|
||||||
|
|||||||
Reference in New Issue
Block a user