[🛠️ Fix] Add auto clean for prev Py-PLS installation

This commit is contained in:
Minoricew
2025-11-18 20:12:00 +08:00
parent cd946a60fb
commit 80354cc310

View File

@@ -2,7 +2,7 @@
const __SCOPE = "main"; const __SCOPE = "main";
const { exec } = require("child_process"); const { exec, execSync } = require("child_process");
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");
const nodeHttps = require("https"); const nodeHttps = require("https");
@@ -301,6 +301,14 @@ const applyAikariIpcHandler = (ipcMain) => {
"Aikari-Installer.exe" "Aikari-Installer.exe"
); );
// Prev PLS Cfg
const OLD_PLS_INSTALL_DIR = path.join(
"C:\\Program Files",
"HugoAura PLS",
"bin"
);
const OLD_PLS_SVC_NAME = "HugoAuraPLS";
const isAikariDetached = process.argv.includes("--aikari-detach"); const isAikariDetached = process.argv.includes("--aikari-detach");
global.__HUGO_AURA__.aikariStats = { global.__HUGO_AURA__.aikariStats = {
@@ -651,6 +659,19 @@ const applyAikariIpcHandler = (ipcMain) => {
} else { } else {
fs.mkdirSync(AIKARI_TEMP_DL_DIR); fs.mkdirSync(AIKARI_TEMP_DL_DIR);
} }
if (fs.existsSync(OLD_PLS_INSTALL_DIR)) {
try {
execSync(`sc stop ${OLD_PLS_SVC_NAME}`);
execSync(`sc delete ${OLD_PLS_SVC_NAME}`);
} catch (err) {
// ...
}
try {
fs.unlinkSync(OLD_PLS_INSTALL_DIR);
} catch (err) {
// ...
}
}
const channel = arg.channel ? arg.channel : "stable"; const channel = arg.channel ? arg.channel : "stable";
const reportWin = arg.reportTo ? arg.reportTo : "assistant"; const reportWin = arg.reportTo ? arg.reportTo : "assistant";
functions.handleAikariDlAndInstall( functions.handleAikariDlAndInstall(