diff --git a/src/main.ts b/src/main.ts index 3cc12832..ade45e95 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,6 +7,8 @@ import { SetupTray } from './tray'; import { IPC_CHANNELS } from './constants'; import dotenv from 'dotenv'; import { app, BrowserWindow, webContents, screen } from 'electron'; +import tar from 'tar'; + // Handle creating/removing shortcuts on Windows when installing/uninstalling. import('electron-squirrel-startup').then((ess) => { const { default: check } = ess; @@ -172,13 +174,13 @@ const launchPythonServer = async (args: { pythonProcess = spawnPython(comfyMainCmd, path.dirname(scriptPath)); } catch { console.log('Running one-time python installation on first startup...'); - // clean up any possible existing non-functional python env - // try { - // await fsPromises.rm(pythonRootPath, {recursive: true}); - // } catch {null;} + //clean up any possible existing non-functional python env + try { + await fsPromises.rm(pythonRootPath, {recursive: true}); + } catch {null;} - // const pythonTarPath = path.join(appResourcesPath, 'python.tgz'); - // await tar.extract({file: pythonTarPath, cwd: userResourcesPath, strict: true}); + const pythonTarPath = path.join(appResourcesPath, 'python.tgz'); + await tar.extract({file: pythonTarPath, cwd: userResourcesPath, strict: true}); const wheelsPath = path.join(pythonRootPath, 'wheels'); // TODO: report space bug to uv upstream, then revert below mac fix