From 08d320ad1c4794e9d93152e66393f3e7bc0b3509 Mon Sep 17 00:00:00 2001 From: JackEnx <167036558+JackEnx@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:34:00 -0300 Subject: [PATCH] fix: win32 path --- src/main/services/process-watcher.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index 08d513da..9a99cbe2 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -75,7 +75,12 @@ const findGamePathByProcess = ( if (hasProcess) { for (const path of [...hasProcess]) { - if (path.toLowerCase().endsWith(executable.name)) { + const executableName = + process.platform === "win32" + ? executable.name.replace("/", "\\") + : executable.name; + + if (path.toLowerCase().endsWith(executableName)) { gameRepository.update( { objectID: id, shop: "steam" }, { executablePath: path } @@ -105,7 +110,9 @@ const getSystemProcessMap = async () => { }; const getExecutable = (path: string) => { - return path.slice(path.lastIndexOf("/") + 1); + return path.slice( + path.lastIndexOf(process.platform === "win32" ? "\\" : "/") + 1 + ); }; export const watchProcesses = async () => {