简体   繁体   English

电子包装器未设置图标

[英]Electron-packager not setting icons

There are lots of questions relating to setting icons using electron-packager but none of the answers have worked for me – maybe the answers are out of date or not clear – but I need to ask again.有很多关于使用electron-packager设置图标的问题,但没有一个答案对我有用——也许答案已经过时或不清楚——但我需要再问一次。

I am building on OSX for OSX & Windows.我正在为 OSX 和 Windows 构建 OSX。 I've tried at least 20 variations on specifying the icon for electron-packager (the full cmd set is below).我已经尝试了至少 20 种为electron-packager指定图标的变体(完整的 cmd 集如下)。 I've tried referencing icons withing the app folder (app/assets/WIN_logo.icns) as well as in an "icons" folder at the project root (icons/assets/WIN_logo.icns);我尝试在应用程序文件夹 (app/assets/WIN_logo.icns) 以及项目根目录 (icons/assets/WIN_logo.icns) 的“icons”文件夹中引用图标; I've tried using quotation marks, leaving off the extension and other stuff I can't even recall.我试过使用引号,省略扩展名和其他我什至不记得的东西。

So please, can someone tell me, given the directory structure below, how I specify the icon for electron-packager to use.所以请有人告诉我,鉴于下面的目录结构,我如何指定electron-packager器使用的图标。

-icon=assets/WIN_logo.icns
-icon=assets/WIN_logo.ico

在此处输入图片说明

  "package-mac": "electron-packager . --overwrite --tmpdir=false --platform=darwin --arch=x64  --prune=true --out=release-builds -icon=assets/WIN_logo.icns",
  "package-win": "electron-packager . --overwrite --tmpdir=false --platform=win32 --arch=ia32 --asar=true  --prune=true --out=release-builds -icon=assets/WIN_logo.ico"

There are lots of questions relating to setting icons using electron-packager but none of the answers have worked for me – maybe the answers are out of date or not clear – but I need to ask again.关于使用electron-packager设置图标有很多问题,但是没有一个答案对我有用-也许答案已经过时或不清楚-但我需要再次询问。

I am building on OSX for OSX & Windows.我正在OSX和Windows的OSX上构建。 I've tried at least 20 variations on specifying the icon for electron-packager (the full cmd set is below).我已经尝试了至少20种指定electron-packager图标的变体(完整的cmd设置在下面)。 I've tried referencing icons withing the app folder (app/assets/WIN_logo.icns) as well as in an "icons" folder at the project root (icons/assets/WIN_logo.icns);我尝试用app文件夹(app / assets / WIN_logo.icns)以及项目根目录下的“ icons”文件夹(icons / assets / WIN_logo.icns)引用图标; I've tried using quotation marks, leaving off the extension and other stuff I can't even recall.我试过使用引号,省去了扩展名和其他我甚至不记得的东西。

So please, can someone tell me, given the directory structure below, how I specify the icon for electron-packager to use.因此,请允许有人告诉我,给定下面的目录结构,我如何指定electron-packager要使用的图标。

-icon=assets/WIN_logo.icns
-icon=assets/WIN_logo.ico

在此处输入图片说明

  "package-mac": "electron-packager . --overwrite --tmpdir=false --platform=darwin --arch=x64  --prune=true --out=release-builds -icon=assets/WIN_logo.icns",
  "package-win": "electron-packager . --overwrite --tmpdir=false --platform=win32 --arch=ia32 --asar=true  --prune=true --out=release-builds -icon=assets/WIN_logo.ico"

There are lots of questions relating to setting icons using electron-packager but none of the answers have worked for me – maybe the answers are out of date or not clear – but I need to ask again.关于使用electron-packager设置图标有很多问题,但是没有一个答案对我有用-也许答案已经过时或不清楚-但我需要再次询问。

I am building on OSX for OSX & Windows.我正在OSX和Windows的OSX上构建。 I've tried at least 20 variations on specifying the icon for electron-packager (the full cmd set is below).我已经尝试了至少20种指定electron-packager图标的变体(完整的cmd设置在下面)。 I've tried referencing icons withing the app folder (app/assets/WIN_logo.icns) as well as in an "icons" folder at the project root (icons/assets/WIN_logo.icns);我尝试用app文件夹(app / assets / WIN_logo.icns)以及项目根目录下的“ icons”文件夹(icons / assets / WIN_logo.icns)引用图标; I've tried using quotation marks, leaving off the extension and other stuff I can't even recall.我试过使用引号,省去了扩展名和其他我甚至不记得的东西。

So please, can someone tell me, given the directory structure below, how I specify the icon for electron-packager to use.因此,请允许有人告诉我,给定下面的目录结构,我如何指定electron-packager要使用的图标。

-icon=assets/WIN_logo.icns
-icon=assets/WIN_logo.ico

在此处输入图片说明

  "package-mac": "electron-packager . --overwrite --tmpdir=false --platform=darwin --arch=x64  --prune=true --out=release-builds -icon=assets/WIN_logo.icns",
  "package-win": "electron-packager . --overwrite --tmpdir=false --platform=win32 --arch=ia32 --asar=true  --prune=true --out=release-builds -icon=assets/WIN_logo.ico"

[1] Icon path: The icon path is not relative to the project directory, but to the current location. [1] 图标路径:图标路径不是相对于项目目录,而是相对于当前位置。 (For me, the problem was that I assumed the former, as I thought it made sense with less redundancy.) In any case, one has to run either: (对我来说,问题是我假设了前者,因为我认为减少冗余是有意义的。)无论如何,必须运行:

electron-packager projectDirPath outputName ... --icon=projectDirPath/iconPath/icon.png

Or if you are in the project directory:或者,如果您在项目目录中:

electron-packager . outputName ... --icon=iconPath/icon.png

[2] Icon format: For macOS, both icon.png and icon.icns is accepted. [2] 图标格式:对于 macOS,icon.png 和 icon.icns 都被接受。 For Windows, both icon.png and icon.ico is accepted.对于 Windows,icon.png 和 icon.ico 都被接受。

[3] Icon size: For macOS, the dimensions must be at least 512x512px. [3] 图标大小:对于 macOS,尺寸必须至少为 512x512 像素。 For Windows, the dimensions must be at least 256x256px.对于 Windows,尺寸必须至少为 256x256 像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM