feat: setting external common redist

This commit is contained in:
Chubby Granny Chaser
2025-04-02 19:06:21 +01:00
parent 01d440590b
commit 379e90568a
17 changed files with 77 additions and 69 deletions

View File

@@ -39,7 +39,7 @@ import "./misc/show-open-dialog";
import "./misc/get-features";
import "./misc/show-item-in-folder";
import "./misc/get-badges";
import "./misc/install-commonredist";
import "./misc/install-common-redist";
import "./torrenting/cancel-game-download";
import "./torrenting/pause-game-download";
import "./torrenting/resume-game-download";

View File

@@ -0,0 +1,10 @@
import { registerEvent } from "../register-event";
import { CommonRedistManager } from "@main/services/common-redist-manager";
const installCommonRedist = async (_event: Electron.IpcMainInvokeEvent) => {
if (await CommonRedistManager.canInstallCommonRedist()) {
CommonRedistManager.installCommonRedist();
}
};
registerEvent("installCommonRedist", installCommonRedist);

View File

@@ -1,26 +0,0 @@
import { app } from "electron";
import path from "node:path";
import cp from "node:child_process";
import { registerEvent } from "../register-event";
import { logger } from "@main/services";
const installScriptPath = app.isPackaged
? path.join(process.resourcesPath, "commonredist", "install.bat")
: path.join(
__dirname,
"..",
"..",
"resources",
"commonredist",
"install.bat"
);
const installCommonRedist = async (_event: Electron.IpcMainInvokeEvent) => {
cp.execFile(installScriptPath, (error) => {
if (error) {
logger.error(error);
}
});
};
registerEvent("installCommonRedist", installCommonRedist);