I'm kind of lost ... sorry if the question is stupid but I need help.
My project is this one: https://github.com/miguelsmuller/centro-de-estudos
I set the icons for linux, windows and mac in main.js file. But it happens the following:
In linux: File icon and docker icon is electron standard.
In windows: The file icon is the default of the electron. The icon in docker is the one configured in main.js.
I know I have to configure the electron-builder icon as well. But what the responsibilities of each one. How to configure the icons correctly?
You should not do it in runtime. See https://github.com/electron-userland/electron-builder#quick-setup-guide
Please, please follow guide and defaults.
Create a directory build in the root of the project and save a background.png (macOS DMG background), icon.icns (macOS app icon) and icon.ico (Windows app icon) into it.
The Linux icon set will be generated automatically based on the macOS icns file (or you can put them into the build/icons directory if you want to specify them yourself. The filename must contain the size (e.g. 32x32.png) of the icon).
Or read all "icon" options in the https://github.com/electron-userland/electron-builder/wiki/Options if you don't want to follow defaults and want to explicitly set all icons.
Is there an option for me to change the default build directory for icons? My build directory is listed in .gitignore.
the default build directory for icons
Yes. https://github.com/electron-userland/electron-builder/wiki/Developer-API#MetadataDirectories-buildResources
"directories": {
"buildResources ": "assets"
}
OK. I did what you suggested. But it looks like it did not work for me, it still uses the default icon.
I used the buildResources option to change the default directory:
"directories": {
"buildResources": "app/assets/images/build"
}
And in this directory you have the files:
The file icon.png measures 512x512. I also have a folder icons with the files:
Before I received the following alert:
⚠️ Application icon is not set, default Electron icon will be used
Now I do not receive more. It means that the icons have been located.
Thanks for clear report. I will check. Please set env DEBUG=electron-builder and attach log of the terminal output. (please update electron-builder to 16.2.1)
Here is debug log:
administrador@laboratorio10:~/centro-de-estudos$ DEBUG=electron-builder npm run pack
> [email protected] pack /home/administrador/centro-de-estudos
> build --dir
electron-builder Two package.json structure is used (dev: /home/administrador/centro-de-estudos/package.json, app: /home/administrador/centro-de-estudos/app/package.json) +0ms
electron-builder Effective config: {
electron-builder "appId": "com.devim.centro-de-estudos",
electron-builder "directories": {
electron-builder "buildResources": "app/assets/images/build"
electron-builder },
electron-builder "extraResources": "app/components",
electron-builder "linux": {
electron-builder "category": "Education",
electron-builder "target": [
electron-builder "AppImage",
electron-builder "deb"
electron-builder ]
electron-builder },
electron-builder "win": {
electron-builder "target": "NSIS"
electron-builder }
electron-builder } +5ms
No native production dependencies
Packaging for linux x64 using electron 1.6.2 to dist/linux-unpacked
electron-builder Spawning /home/administrador/centro-de-estudos/node_modules/7zip-bin-linux/x64/7za x -bd /home/administrador/.electron/electron-v1.6.2-linux-x64.zip -o/home/administrador/centro-de-estudos/dist/linux-unpacked +10s
7-Zip (a) [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31
p7zip Version 15.14.1 (locale=pt_BR.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Pentium(R) Dual-Core CPU E5300 @ 2.60GHz (1067A),ASM)
Scanning the drive for archives:
1 file, 47588468 bytes (46 MiB)
Extracting archive: /home/administrador/.electron/electron-v1.6.2-linux-x64.zip
--
Path = /home/administrador/.electron/electron-v1.6.2-linux-x64.zip
Type = zip
Physical Size = 47588468
Everything is Ok
Files: 70
Size: 126350486
Compressed: 47588468
electron-builder /home/administrador/centro-de-estudos/node_modules/7zip-bin-linux/x64/7za (5812) exited with code 0 +2s
electron-builder Dev or extraneous dependencies: ../../electron-builder.yml, ../../electron-builder.json, ../../electron-builder.json5 +5ms
electron-builder Copying /home/administrador/centro-de-estudos to /home/administrador/centro-de-estudos/dist/linux-unpacked/resources +3s
I upgraded the electron-builder to version 16.3.0. On windows worked as expected. In linux I still can not solve the problem. Follow the images below.
Can you consider this issue as open?
I still doesn't have time to investigate. I will try to find time in 2 days.
windows, macOS — icon correctly set.
linux — I get clear error (it seems you are using old electron-builder version. Will be fixed.
The documentation still isn't very clear on how to handle icons. It took me quite a bit of searching to figure out that I needed to make an assets/build folder along with NOT having a leading slash in front of the 'buildResources' path in the package.json, as @develar posted above.
Really think the documentation should have examples. Really does help clarify things. Don't find Electron Builder's docs to be very intuitive.
Seriously the docs for this are reallyyy bad. @brett84c I'm going to try that now, hopefully it works. Getting kinda tired of fighting this extremely simple thing.
@brett84c you are now my favorite person. Thanks for posting this
@brett84c It is no-go way. What's better — add checks (to assist) and support intuitive forms. So — post issue in the form: 1) code to reproduce (config?) 2) expected 3) actual So, instead of documenting pitfall, I will fix the root cause.
Most helpful comment
The documentation still isn't very clear on how to handle icons. It took me quite a bit of searching to figure out that I needed to make an assets/build folder along with NOT having a leading slash in front of the 'buildResources' path in the package.json, as @develar posted above.
Really think the documentation should have examples. Really does help clarify things. Don't find Electron Builder's docs to be very intuitive.