Open buu700 opened 5 years ago
Until this is fixed, as a workaround, you can copy those icons into platforms/electron/build-res/appx/
.
@buu700 When I copy those icons to the folder appx, I get the following error
The path (/p) parameter is: "my-project-location\platforms\electron\build\app.appx"
The mapping file (/f) parameter is: "my-project-location\platforms\electron\build\__appx-x64\mapping.txt"
Reading mapping file "my-project-location\platforms\electron\build\__appx-x64\mapping.txt"
MakeAppx : error: You can't add both "my-project-location\platforms\electron\build-res\appx\Square44X44Logo.png" and "C:\Users\{user}\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.4.0\appxAssets\SampleAppx.44x44.png" to the output file as "assets\Square44x44Logo.png".
Am I missing something?
To fix this problem I use this custom hook :
module.exports = function(context) {
console.log('[HACK] Copy of all electron icons');
//Prevent this running for other platforms.
if ( context.opts.platforms.indexOf('electron') < 0 ) {
return;
}
var fs = require('fs'),
path = require('path')
const iconsPath = path.join(context.opts.projectRoot, 'resources/electron/icon/icon.png');
const destination = path.join(context.opts.projectRoot, 'platforms/electron/build-res/icon.png');
fs.createReadStream(iconsPath).pipe(fs.createWriteStream(destination));
};
And then call it from your Config.xml file
<platform name="electron">
<hook src="hooks/copy-icons.js" type="after_prepare" />
<icon src="resources/electron/icon/icon.png" />
</platform>
Bug Report
Problem
What is expected to happen?
The appx (Windows Store) package should have my app icon set as its icon.
If what's below isn't the correct way to configure this for Electron, the correct solution should ideally be documented.
What does actually happen?
My configuration below and icons are ignored; the default Electron icons are used instead.
Information
You can unzip the appx file and see that only the default Electron icons appear under assets.
Command or Code
cordova build electron
Environment, Platform, Device
macOS 10.14.6
Version information
Cordova 9.0.0
Checklist