From 2e2a95c3146cb92f5d32506fc5e7b3bbb107ff7d Mon Sep 17 00:00:00 2001 From: Moyasee Date: Wed, 28 Jan 2026 13:38:49 +0200 Subject: [PATCH 1/2] feat: implement automatic shortcut creation upon automatic path binding --- src/main/services/game-files-manager.ts | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main/services/game-files-manager.ts b/src/main/services/game-files-manager.ts index 722e1c9e..307903aa 100644 --- a/src/main/services/game-files-manager.ts +++ b/src/main/services/game-files-manager.ts @@ -8,6 +8,10 @@ import { WindowManager } from "./window-manager"; import { publishExtractionCompleteNotification } from "./notifications"; import { logger } from "./logger"; import { GameExecutables } from "./game-executables"; +import createDesktopShortcut from "create-desktop-shortcuts"; +import { app } from "electron"; +import { removeSymbolsFromName } from "@shared"; +import { SystemPath } from "./system-path"; const PROGRESS_THROTTLE_MS = 1000; @@ -204,6 +208,8 @@ export class GameFilesManager { }); WindowManager.mainWindow?.webContents.send("on-library-batch-complete"); + + await this.createDesktopShortcutForGame(game.title, foundExePath); } } catch (err) { logger.error( @@ -213,6 +219,40 @@ export class GameFilesManager { } } + private async createDesktopShortcutForGame( + gameTitle: string, + executablePath: string + ): Promise { + try { + const windowVbsPath = app.isPackaged + ? path.join(process.resourcesPath, "windows.vbs") + : undefined; + + const options = { + filePath: executablePath, + name: removeSymbolsFromName(gameTitle), + outputPath: SystemPath.getPath("desktop"), + }; + + const success = createDesktopShortcut({ + windows: { ...options, VBScriptPath: windowVbsPath }, + linux: options, + osx: options, + }); + + if (success) { + logger.info( + `[GameFilesManager] Created desktop shortcut for ${this.objectId}` + ); + } + } catch (err) { + logger.error( + `[GameFilesManager] Error creating desktop shortcut: ${this.objectId}`, + err + ); + } + } + private async findExecutableInFolder( folderPath: string, executableNames: string[] From 8bf70cd2b4d0d5b22b9c1aa5c612d4133af597e3 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Wed, 28 Jan 2026 13:43:12 +0200 Subject: [PATCH 2/2] fix: multiple imports --- src/main/services/game-files-manager.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/services/game-files-manager.ts b/src/main/services/game-files-manager.ts index 307903aa..6b700986 100644 --- a/src/main/services/game-files-manager.ts +++ b/src/main/services/game-files-manager.ts @@ -2,7 +2,7 @@ import path from "node:path"; import fs from "node:fs"; import type { GameShop } from "@types"; import { downloadsSublevel, gamesSublevel, levelKeys } from "@main/level"; -import { FILE_EXTENSIONS_TO_EXTRACT } from "@shared"; +import { FILE_EXTENSIONS_TO_EXTRACT, removeSymbolsFromName } from "@shared"; import { SevenZip, ExtractionProgress } from "./7zip"; import { WindowManager } from "./window-manager"; import { publishExtractionCompleteNotification } from "./notifications"; @@ -10,7 +10,6 @@ import { logger } from "./logger"; import { GameExecutables } from "./game-executables"; import createDesktopShortcut from "create-desktop-shortcuts"; import { app } from "electron"; -import { removeSymbolsFromName } from "@shared"; import { SystemPath } from "./system-path"; const PROGRESS_THROTTLE_MS = 1000;