From 7ea86da788cf762932ebc0d3dee3974985cef31e Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Thu, 25 Jan 2024 00:38:05 +0100 Subject: [PATCH] handle config --- src/main/pkg_mng/index.js | 45 ++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/main/pkg_mng/index.js b/src/main/pkg_mng/index.js index fb6ab64..2168bf1 100644 --- a/src/main/pkg_mng/index.js +++ b/src/main/pkg_mng/index.js @@ -274,6 +274,18 @@ export default class PkgManager { } } + if (changes.configs) { + if (!manifest.storaged_configs) { + manifest.storaged_configs = {} + } + + if (Object.keys(changes.configs).length !== 0) { + Object.entries(changes.configs).forEach(([key, value]) => { + manifest.storaged_configs[key] = value + }) + } + } + manifest.status = "installed" sendToRender(`installation:done`, { @@ -583,20 +595,33 @@ export default class PkgManager { process.on("error", reject) }) } else { - if (typeof manifest.execute !== "function") { - sendToRender("installation:status", { + try { + if (typeof manifest.execute !== "function") { + sendToRender("installation:status", { + status: "execution_failed", + ...manifest, + }) + + return false + } + + await manifest.execute({ + manifest, + pack_dir: manifest.install_path, + tmp_dir: TMP_PATH, + }) + } catch (error) { + sendToRender("new:notification", { + message: "Failed to launch", + description: error.toString(), + type: "error", + }) + + return sendToRender("installation:status", { status: "execution_failed", ...manifest, }) - - return false } - - await manifest.execute({ - manifest, - pack_dir: manifest.install_path, - tmp_dir: TMP_PATH - }) } sendToRender("installation:status", {