Skip to content

Commit

Permalink
try/catch rmSync
Browse files Browse the repository at this point in the history
  • Loading branch information
matthme committed Jul 9, 2024
1 parent dadb4ba commit d441223
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/filesystem.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { App } from 'electron';
import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -204,7 +205,12 @@ export class LauncherFileSystem {
console.log('before keep logs.');
if (keepLogs) throw new Error('Keeping logs across factory reset is currently not supported.');
console.log('after keep logs but before removing all data.');
// fs.rmSync(this.profileDataDir, { recursive: true });
try {
fs.rmSync(this.profileDataDir, { recursive: true });
} catch (e: any) {
console.error('Failed to remove directories: ', e);
console.error('Failed to remove directories (string): ', e.toString());
}
console.log('No data removed, rmSync skipped.');
}
}
Expand Down

0 comments on commit d441223

Please sign in to comment.