From 29b64237ed836ee5918ad379aaf7525e50b5f4c7 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:57:03 -0300 Subject: [PATCH] feat: remove old vbs file --- src/main/events/user-preferences/auto-launch.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/events/user-preferences/auto-launch.ts b/src/main/events/user-preferences/auto-launch.ts index 712f388b..fc05fb62 100644 --- a/src/main/events/user-preferences/auto-launch.ts +++ b/src/main/events/user-preferences/auto-launch.ts @@ -1,6 +1,17 @@ import { registerEvent } from "../register-event"; import AutoLaunch from "auto-launch"; import { app } from "electron"; +import path from "path"; +import fs from "node:fs"; + +const windowsStartupPath = path.join( + app.getPath("appData"), + "Microsoft", + "Windows", + "Start Menu", + "Programs", + "Startup" +); const autoLaunch = async ( _event: Electron.IpcMainInvokeEvent, @@ -15,6 +26,10 @@ const autoLaunch = async ( if (enabled) { appLauncher.enable().catch(() => {}); } else { + if (process.platform == "win32") { + fs.rm(path.join(windowsStartupPath, "Hydra.vbs"), () => {}); + } + appLauncher.disable().catch(() => {}); } };