From 5607f6d524e654717bb4f85beb3d6590a854e6a8 Mon Sep 17 00:00:00 2001 From: JackEnx <167036558+JackEnx@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:42:07 -0300 Subject: [PATCH] refactor: move executable name replate outside the forof --- src/main/services/process-watcher.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index f3f06109..fda22a56 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -66,10 +66,10 @@ const findGamePathByProcess = ( const hasProcess = processMap.get(exe); if (hasProcess) { + const executableName = executable.name.replace(/\//g, "\\"); + for (const path of [...hasProcess]) { - if ( - path.toLowerCase().endsWith(executable.name.replace(/\//g, "\\")) - ) { + if (path.toLowerCase().endsWith(executableName)) { gameRepository.update( { objectID: id, shop: "steam" }, { executablePath: path }