diff --git a/src/handlers/appInfoHandlers.ts b/src/handlers/appInfoHandlers.ts index 7cf73584..c1c43395 100644 --- a/src/handlers/appInfoHandlers.ts +++ b/src/handlers/appInfoHandlers.ts @@ -31,7 +31,6 @@ export function registerAppInfoHandlers(appWindow: AppWindow) { const basePath = result.filePaths[0]; useDesktopConfig().set('basePath', basePath); - // TODO: Replace with new base path config return await ComfyServerConfig.setBasePathInDefaultConfig(basePath); }); diff --git a/src/main-process/appWindow.ts b/src/main-process/appWindow.ts index 8c2a33f9..b21d1144 100644 --- a/src/main-process/appWindow.ts +++ b/src/main-process/appWindow.ts @@ -278,7 +278,6 @@ export class AppWindow { } private setupWindowEvents(): void { - // eslint-disable-next-line unicorn/consistent-function-scoping const updateBounds = () => { if (!this.window) return; diff --git a/src/main-process/comfyInstallation.ts b/src/main-process/comfyInstallation.ts index cbaf2179..e02f0d1c 100644 --- a/src/main-process/comfyInstallation.ts +++ b/src/main-process/comfyInstallation.ts @@ -20,6 +20,11 @@ export class ComfyInstallation { return this._basePath; } + private _virtualEnvironment: VirtualEnvironment; + public get virtualEnvironment(): VirtualEnvironment { + return this._virtualEnvironment; + } + /** Installation issues, such as missing base path, no venv. Populated by {@link validate}. */ validation: InstallValidation = { inProgress: false, @@ -35,11 +40,6 @@ export class ComfyInstallation { return this.state === 'installed' && !this.hasIssues; } - private _virtualEnvironment: VirtualEnvironment; - public get virtualEnvironment(): VirtualEnvironment { - return this._virtualEnvironment; - } - /** * Called during/after each step of validation * @param data The data to send to the renderer @@ -53,7 +53,7 @@ export class ComfyInstallation { basePath: string, /** The device type to use for the installation. */ public readonly telemetry: ITelemetry, - public readonly comfySettings: ComfySettings + public comfySettings: ComfySettings ) { this._basePath = basePath; this._virtualEnvironment = this.createVirtualEnvironment(basePath); @@ -110,7 +110,7 @@ export class ComfyInstallation { // Validate base path const basePath = useDesktopConfig().get('basePath'); if (basePath && (await pathAccessible(basePath))) { - this.updateBasePathAndVenv(basePath); + await this.updateBasePathAndVenv(basePath); validation.basePath = 'OK'; this.onUpdate?.(validation); @@ -203,11 +203,13 @@ export class ComfyInstallation { * Updates the base path and recreates the virtual environment (object). * @param basePath The new base path to set. */ - updateBasePathAndVenv(basePath: string) { + async updateBasePathAndVenv(basePath: string) { if (this._basePath === basePath) return; this._basePath = basePath; this._virtualEnvironment = this.createVirtualEnvironment(basePath); + this.comfySettings = new ComfySettings(basePath); + await this.comfySettings.loadSettings(); useDesktopConfig().set('basePath', basePath); }