Skip to content

Commit

Permalink
Merge pull request #624 from hydralauncher/fix/copy-vbs-script-to-app…
Browse files Browse the repository at this point in the history
…-resources-on-build

Fix/copy vbs script to app resources on build
  • Loading branch information
zamitto authored Jun 22, 2024
2 parents 6e2136e + ebda8ec commit 92a3061
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ directories:
extraResources:
- aria2
- seeds
- fastlist.exe
- from: node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe
to: fastlist.exe
- from: node_modules/create-desktop-shortcuts/src/windows.vbs
files:
- "!**/.vscode/*"
- "!src/*"
Expand Down
7 changes: 0 additions & 7 deletions postinstall.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,4 @@ const downloadAria2 = async () => {
});
};

if (process.platform === "win32") {
fs.copyFileSync(
"node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe",
"fastlist.exe"
);
}

downloadAria2();
13 changes: 11 additions & 2 deletions src/main/events/library/create-game-shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { gameRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import { IsNull, Not } from "typeorm";
import createDesktopShortcut from "create-desktop-shortcuts";
import path from "node:path";
import { app } from "electron";

const createGameShortcut = async (
_event: Electron.IpcMainInvokeEvent,
Expand All @@ -14,10 +16,17 @@ const createGameShortcut = async (
if (game) {
const filePath = game.executablePath;

const options = { filePath, name: game.title };
const windowVbsPath = app.isPackaged
? path.join(process.resourcesPath, "windows.vbs")
: undefined;

const options = {
filePath,
name: game.title,
};

return createDesktopShortcut({
windows: options,
windows: { ...options, VBScriptPath: windowVbsPath },
linux: options,
osx: options,
});
Expand Down

0 comments on commit 92a3061

Please sign in to comment.