Skip to content

Commit

Permalink
fix(macOS): delete user folder when hard resetting and always delete …
Browse files Browse the repository at this point in the history
…bundle
  • Loading branch information
NikhilNarayana committed Feb 24, 2024
1 parent 16ab255 commit d45f3b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/dolphin/install/ishiiruka_installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { DolphinVersionResponse } from "./fetch_latest_version";
const log = electronLog.scope("dolphin/ishiiInstallation");

const isLinux = process.platform === "linux";
const isMac = process.platform === "darwin";

// taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
const semverRegex =
Expand Down Expand Up @@ -260,7 +261,7 @@ export class IshiirukaDolphinInstallation implements DolphinInstallation {

private async _uninstallDolphin() {
await fs.remove(this.installationFolder);
if (isLinux) {
if (isLinux || isMac) {
await fs.remove(this.userFolder);
}
}
Expand All @@ -271,6 +272,11 @@ export class IshiirukaDolphinInstallation implements DolphinInstallation {
if (cleanInstall) {
await this._uninstallDolphin();
} else {
if (isLinux || isMac) {
// macOS and Linux use bundles which are safe to delete since they contain no user config
// deleting the bundle first lets us ignore any issues that would come up when overwriting the bundle
await fs.remove(this.installationFolder);
}
await this.clearCache(); // clear cache to avoid shader issues on new versions
}

Expand Down
8 changes: 7 additions & 1 deletion src/dolphin/install/mainline_installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { DolphinVersionResponse } from "./fetch_latest_version";
const log = electronLog.scope("dolphin/mainlineInstallation");

const isLinux = process.platform === "linux";
const isMac = process.platform === "darwin";

// taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
const semverRegex =
Expand Down Expand Up @@ -256,7 +257,7 @@ export class MainlineDolphinInstallation implements DolphinInstallation {

private async _uninstallDolphin() {
await fs.remove(this.installationFolder);
if (isLinux) {
if (isLinux || isMac) {
await fs.remove(this.userFolder);
}
}
Expand All @@ -267,6 +268,11 @@ export class MainlineDolphinInstallation implements DolphinInstallation {
if (cleanInstall) {
await this._uninstallDolphin();
} else {
if (isLinux || isMac) {
// macOS and Linux use bundles which are safe to delete since they contain no user config
// deleting the bundle first lets us ignore any issues that would come up when overwriting the bundle
await fs.remove(this.installationFolder);
}
await this.clearCache(); // clear cache to avoid shader issues on new versions
}

Expand Down

0 comments on commit d45f3b4

Please sign in to comment.