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
30 lines
961 B
TypeScript
30 lines
961 B
TypeScript
import type { FileWriteErrorType, FileWriteOutcome, ReadbackFileWriter } from '@/infrastructure/FileSystem/ReadbackFileWriter/ReadbackFileWriter';
|
|
import { StubWithObservableMethodCalls } from './StubWithObservableMethodCalls';
|
|
|
|
export class ReadbackFileWriterStub
|
|
extends StubWithObservableMethodCalls<ReadbackFileWriter>
|
|
implements ReadbackFileWriter {
|
|
private outcome: FileWriteOutcome = { success: true };
|
|
|
|
public writeAndVerifyFile(
|
|
...args: Parameters<ReadbackFileWriter['writeAndVerifyFile']>
|
|
): Promise<FileWriteOutcome> {
|
|
this.registerMethodCall({
|
|
methodName: 'writeAndVerifyFile',
|
|
args: [...args],
|
|
});
|
|
return Promise.resolve(this.outcome);
|
|
}
|
|
|
|
public configureFailure(errorType: FileWriteErrorType, message: string): this {
|
|
this.outcome = {
|
|
success: false,
|
|
error: {
|
|
type: errorType,
|
|
message: `[${ReadbackFileWriterStub.name}] ${message}`,
|
|
},
|
|
};
|
|
return this;
|
|
}
|
|
}
|