Skip to content

Commit

Permalink
fix(win): enable icon (#905)
Browse files Browse the repository at this point in the history
Co-authored-by: owen_hammer <[email protected]>
  • Loading branch information
hammerOwen and owen_hammer authored Aug 2, 2023
1 parent 49bdb75 commit 547e90c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/bld/winCfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { log } from "../log.js";
* @property {string} company Company that produced the file—for example, Microsoft Corporation or Standard Microsystems Corporation, Inc. This string is required.
* @property {string} fileDescription File description to be presented to users. This string may be displayed in a list box when the user is choosing files to install. For example, Keyboard Driver for AT-Style Keyboards. This string is required.
* @property {string} fileVersion Version number of the file. For example, 3.10 or 5.00.RC2. This string is required.
* @property {string} icon The path to the icon file. It should be a .ico file.
* @property {string} internalName Internal name of the file, if one exists—for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required.
* @property {string} legalCopyright Copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional.
* @property {string} legalTrademark Trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional.
Expand Down Expand Up @@ -55,14 +56,20 @@ const setWinConfig = async (app, outDir) => {
}
});

const rcEditOptions = {
"file-version": app.version,
"product-version": app.version,
"version-string": versionString,
}

if (app.icon) {
rcEditOptions.icon = app.icon
}

try {
const outDirAppExe = resolve(outDir, `${app.name}.exe`);
await rename(resolve(outDir, "nw.exe"), outDirAppExe);
await rcedit(outDirAppExe, {
"file-version": app.version,
"product-version": app.version,
"version-string": versionString,
});
await rcedit(outDirAppExe, rcEditOptions);
} catch (error) {
log.warn(
"Renaming EXE failed or unable to modify EXE. If it's the latter, ensure WINE is installed or build your application Windows platform",
Expand Down

0 comments on commit 547e90c

Please sign in to comment.