From eea4ae47c7012a8e04cc8320e474c42aa13f7f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Ili=C4=87?= Date: Wed, 26 Apr 2023 22:55:28 +0200 Subject: [PATCH] fix for copy mod names not working --- package.json | 2 +- src/components/OptionsDrawer.tsx | 3 --- src/index.ts | 13 ++++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0acee7a..4674ccd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "wh3mm", "productName": "wh3mm", - "version": "1.35.0", + "version": "1.35.1", "description": "WH3 Mod Manager", "main": ".webpack/main", "scripts": { diff --git a/src/components/OptionsDrawer.tsx b/src/components/OptionsDrawer.tsx index 7ac6f5c..c326d76 100644 --- a/src/components/OptionsDrawer.tsx +++ b/src/components/OptionsDrawer.tsx @@ -34,9 +34,6 @@ const cleanSymbolicLinksInData = () => { const exportModNamesToClipboard = (enabledMods: Mod[]) => { window.api?.exportModNamesToClipboard(enabledMods); }; -const createSteamCollection = (enabledMods: Mod[]) => { - window.api?.createSteamCollection(enabledMods); -}; type OptionType = { value: string; diff --git a/src/index.ts b/src/index.ts index 9ba6600..701c3d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import debounce from "just-debounce-it"; import { AmendedSchemaField, Pack, PackCollisions, SCHEMA_FIELD_TYPE, SchemaField } from "./packFileTypes"; -import { execFile, exec, fork, execFileSync } from "child_process"; +import { execFile, exec, fork } from "child_process"; import { app, autoUpdater, BrowserWindow, clipboard, dialog, ipcMain, shell } from "electron"; import installExtension, { REDUX_DEVTOOLS } from "electron-devtools-installer"; import fetch from "electron-fetch"; @@ -1269,6 +1269,17 @@ if (!gotTheLock) { clipboard.writeText(exportedMods); }); + ipcMain.on("exportModNamesToClipboard", async (event, mods: Mod[]) => { + const sortedMods = sortByNameAndLoadOrder(mods); + const enabledMods = sortedMods.filter((mod) => mod.isEnabled); + + const exportedMods = enabledMods + .filter((mod) => mod.humanName != "") + .map((mod) => mod.humanName) + .join("\n"); + clipboard.writeText(exportedMods); + }); + ipcMain.on("createSteamCollection", async (event, mods: Mod[]) => { const workshopIDs = mods.map((mod) => mod.workshopId); const scriptWithIDs = steamCollectionScript.replace(