From cd227a456ace3a7054b9e075682863c51a52f9d4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 26 Apr 2023 15:05:58 +0100 Subject: [PATCH] Make SonarCloud happier about our code quality (#632) --- src/squirrelhooks.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/squirrelhooks.ts b/src/squirrelhooks.ts index 5e06d45..b488898 100644 --- a/src/squirrelhooks.ts +++ b/src/squirrelhooks.ts @@ -36,20 +36,24 @@ function checkSquirrelHooks(): boolean { if (process.platform !== "win32") return false; const cmd = process.argv[1]; const target = path.basename(process.execPath); - if (cmd === "--squirrel-install") { - runUpdateExe(["--createShortcut=" + target]).then(() => app.quit()); - return true; - } else if (cmd === "--squirrel-updated") { - app.quit(); - return true; - } else if (cmd === "--squirrel-uninstall") { - runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit()); - return true; - } else if (cmd === "--squirrel-obsolete") { - app.quit(); - return true; + + switch (cmd) { + case "--squirrel-install": + runUpdateExe(["--createShortcut=" + target]).then(() => app.quit()); + return true; + + case "--squirrel-updated": + case "--squirrel-obsolete": + app.quit(); + return true; + + case "--squirrel-uninstall": + runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit()); + return true; + + default: + return false; } - return false; } if (checkSquirrelHooks()) {