Skip to content

Commit

Permalink
Add option to download git if missing (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered authored Feb 7, 2025
1 parent 7f48aee commit 6d3d30e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/install/installationManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Notification, app, dialog, ipcMain } from 'electron';
import { Notification, app, dialog, ipcMain, shell } from 'electron';
import log from 'electron-log/main';

import { ComfySettings } from '@/config/comfySettings';
Expand All @@ -10,7 +10,7 @@ import type { InstallOptions } from '../preload';
import { CmCli } from '../services/cmCli';
import { type HasTelemetry, ITelemetry, trackEvent } from '../services/telemetry';
import { type DesktopConfig, useDesktopConfig } from '../store/desktopConfig';
import { ansiCodes, validateHardware } from '../utils';
import { ansiCodes, canExecuteShellCommand, validateHardware } from '../utils';
import type { ProcessCallbacks, VirtualEnvironment } from '../virtualEnvironment';
import { InstallWizard } from './installWizard';

Expand Down Expand Up @@ -182,6 +182,26 @@ export class InstallationManager implements HasTelemetry {
await this.appWindow.loadPage('welcome');
}

// Check if git is installed
log.verbose('Checking if git is installed.');
const gitInstalled = await canExecuteShellCommand('git --version');
if (!gitInstalled) {
log.verbose('git not detected in path, loading download-git page.');

const { response } = await this.appWindow.showMessageBox({
type: 'info',
title: 'Download git',
message: `We were unable to find git on this device.\n\nPlease download and install git before continuing with the installation of ComfyUI Desktop.`,
buttons: ['Open git downloads page', 'Skip'],
defaultId: 0,
cancelId: 1,
});

if (response === 0) {
await shell.openExternal('https://git-scm.com/downloads/');
}
}

// Handover to frontend
const installOptions = await optionsPromise;
this.telemetry.track('desktop:install_options_received', {
Expand Down

0 comments on commit 6d3d30e

Please sign in to comment.