Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove temp files on startup #445

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading