Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix base path maintenance task failure #789

Merged
merged 5 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/handlers/appInfoHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
1 change: 0 additions & 1 deletion src/main-process/appWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ export class AppWindow {
}

private setupWindowEvents(): void {
// eslint-disable-next-line unicorn/consistent-function-scoping
const updateBounds = () => {
if (!this.window) return;

Expand Down
18 changes: 10 additions & 8 deletions src/main-process/comfyInstallation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
Loading