Skip to content

Commit

Permalink
Load not supported page when hardware is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Nov 27, 2024
1 parent ac91964 commit 08e9a11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/handlers/pathHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import fs from 'fs';
import si from 'systeminformation';
import { ComfyConfigManager } from '../config/comfyConfigManager';
import path from 'path';
import { validateHardware } from '../utils';

export class PathHandlers {
static readonly REQUIRED_SPACE = 10 * 1024 * 1024 * 1024; // 10GB in bytes
Expand Down Expand Up @@ -43,10 +42,6 @@ export class PathHandlers {
ipcMain.handle(
IPC_CHANNELS.VALIDATE_INSTALL_PATH,
async (event, inputPath: string): Promise<{ isValid: boolean; error?: string }> => {
const validation = await validateHardware();
if (!validation.isValid) {
return validation;
}
try {
// Check if path exists
if (!fs.existsSync(inputPath)) {
Expand Down
8 changes: 7 additions & 1 deletion src/main-process/comfyDesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ComfyServerConfig } from '../config/comfyServerConfig';
import fs from 'fs';
import { InstallOptions } from '../preload';
import path from 'path';
import { getModelsDirectory } from '../utils';
import { getModelsDirectory, validateHardware } from '../utils';
import { DownloadManager } from '../models/DownloadManager';
import { VirtualEnvironment } from '../virtualEnvironment';
import { InstallWizard } from '../install/installWizard';
Expand Down Expand Up @@ -133,6 +133,12 @@ export class ComfyDesktopApp {
* Install ComfyUI and return the base path.
*/
static async install(appWindow: AppWindow): Promise<string> {
const validation = await validateHardware();
if (!validation.isValid) {
await appWindow.loadRenderer('not-supported');
throw new Error(validation.error);
}

await appWindow.loadRenderer('welcome');
return new Promise<string>((resolve) => {
ipcMain.on(IPC_CHANNELS.INSTALL_COMFYUI, async (event, installOptions: InstallOptions) => {
Expand Down

0 comments on commit 08e9a11

Please sign in to comment.