Skip to content

Commit

Permalink
refactor: remove temp files on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilNarayana committed Sep 16, 2024
1 parent 734d5da commit efaab72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/dolphin/install/ishiiruka_installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,5 @@ export class IshiirukaDolphinInstallation implements DolphinInstallation {
);
}
}
await fs.remove(assetPath).catch((err) => {
log.error(`Could not delete dolphin asset: ${err}`);
});
}
}
3 changes: 0 additions & 3 deletions src/dolphin/install/mainline_installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,5 @@ export class MainlineDolphinInstallation implements DolphinInstallation {
);
}
}
await fs.remove(assetPath).catch((err) => {
log.error(`Could not delete dolphin asset: ${err}`);
});
}
}
13 changes: 13 additions & 0 deletions src/renderer/lib/hooks/use_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ export const useAppInitialization = () => {
// Check if there is an update to the launcher
promises.push(window.electron.common.checkForAppUpdates());

// Remove any temp files
promises.push(
(async () => {
window.electron.common.clearTempFolder().catch((err) => {
// silently fail since this isn't a critical issue
log.error(
`Could not clear temp folder on startup due to:
${err instanceof Error ? err.message : JSON.stringify(err)}`,
);
});
})(),
);

// Wait for all the promises to complete before completing
try {
await Promise.all(promises);
Expand Down

0 comments on commit efaab72

Please sign in to comment.