Skip to content

Commit

Permalink
fix for copy mod names not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazbot committed Apr 26, 2023
1 parent 8dbf153 commit eea4ae4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wh3mm",
"productName": "wh3mm",
"version": "1.35.0",
"version": "1.35.1",
"description": "WH3 Mod Manager",
"main": ".webpack/main",
"scripts": {
Expand Down
3 changes: 0 additions & 3 deletions src/components/OptionsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit eea4ae4

Please sign in to comment.