diff --git a/apps/frontend/src/main/index.ts b/apps/frontend/src/main/index.ts index 7cd856a0..f236c4a7 100644 --- a/apps/frontend/src/main/index.ts +++ b/apps/frontend/src/main/index.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, shell, nativeImage } from 'electron'; +import { app, BrowserWindow, shell, nativeImage, session } from 'electron'; import { join } from 'path'; import { accessSync, readFileSync, writeFileSync } from 'fs'; import { electronApp, optimizer, is } from '@electron-toolkit/utils'; @@ -110,11 +110,25 @@ if (process.platform === 'darwin') { app.name = 'Auto Claude'; } +// Fix Windows GPU cache permission errors (0x5 Access Denied) +if (process.platform === 'win32') { + app.commandLine.appendSwitch('disable-gpu-shader-disk-cache'); + app.commandLine.appendSwitch('disable-gpu-program-cache'); + console.log('[main] Applied Windows GPU cache fixes'); +} + // Initialize the application app.whenReady().then(() => { // Set app user model id for Windows electronApp.setAppUserModelId('com.autoclaude.ui'); + // Clear cache on Windows to prevent permission errors from stale cache + if (process.platform === 'win32') { + session.defaultSession.clearCache() + .then(() => console.log('[main] Cleared cache on startup')) + .catch((err) => console.warn('[main] Failed to clear cache:', err)); + } + // Set dock icon on macOS if (process.platform === 'darwin') { const iconPath = getIconPath();