This fixes issue #417 where autoupdate installer files were not deleted on macOS, leading to accumulation of old installers. Key changes: - Store update files in application-specific directory - Clear update files directory on every app launch Other supporting changes: - Refactor file system operations to be more testable and reusable - Improve separation of concerns in directory management - Enhance dependency injection for auto-update logic - Fix async completion to support `await` operations - Add additional logging and revise some log messages during updates
18 lines
639 B
TypeScript
18 lines
639 B
TypeScript
import { app } from 'electron/main';
|
|
import { shell } from 'electron/common';
|
|
import { ElectronLogger } from '@/infrastructure/Log/ElectronLogger';
|
|
import { retryFileSystemAccess } from './FileSystemAccessorWithRetry';
|
|
|
|
export async function startInstallation(filePath: string): Promise<boolean> {
|
|
return retryFileSystemAccess(async () => {
|
|
ElectronLogger.info(`Attempting to open the installer at: ${filePath}.`);
|
|
const error = await shell.openPath(filePath);
|
|
if (!error) {
|
|
app.quit();
|
|
return true;
|
|
}
|
|
ElectronLogger.error(`Failed to open the installer at ${filePath}.`, error);
|
|
return false;
|
|
});
|
|
}
|