From 2789b300513fc699dee789564cf8f849feccab42 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 18 Jun 2024 14:49:00 +0200 Subject: [PATCH] try to pre-contextualize with db --- packages/core/src/manifest/vm.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/core/src/manifest/vm.js b/packages/core/src/manifest/vm.js index bcf42e3..aef24e2 100644 --- a/packages/core/src/manifest/vm.js +++ b/packages/core/src/manifest/vm.js @@ -3,6 +3,8 @@ import Logger from "../logger" import os from "node:os" import vm from "node:vm" import path from "node:path" + +import DB from "../db" import ManifestConfigManager from "../classes/ManifestConfig" import resolveOs from "../utils/resolveOs" @@ -13,10 +15,20 @@ import Settings from "../classes/Settings" import Vars from "../vars" async function BuildManifest(baseClass, context, { soft = false } = {}) { - const packagesPath = await Settings.get("packages_path") ?? Vars.packages_path - - // inject install_path - context.install_path = path.resolve(packagesPath, baseClass.id) + // try to find install_path on db + const pkg = await DB.getPackages(baseClass.id) + + if (pkg) { + if (pkg.install_path) { + context.install_path = pkg.install_path + } + } else { + const packagesPath = await Settings.get("packages_path") ?? Vars.packages_path + + // inject install_path + context.install_path = path.resolve(packagesPath, baseClass.id) + } + baseClass.install_path = context.install_path if (soft === true) {