macos - electron-forge @maker-dmg 如何在 dmg 安装程序中更改图标位置
问题描述
我一直在尝试修改 中的一些参数maker-dmg
,到目前为止,除了图标位置之外,我得到了所有我想要的。
这就是我目前所拥有的:
name: "@electron-forge/maker-dmg",
config: {
title: "Gallery",
background: "src/assets/installer-assets/installBackground.png",
format: "ULFO",
icon: "src/assets/installer-assets/brand-icon.icns",
contents: [
{ x: 192, y: 344, type: "file", path: "Gallery.app" },
{ x: 428, y: 344, type: "link", path: "/Applications" }
]
}
但我收到一条错误消息,说它找不到 Gallery.app。
制作目标时出错:dmg "Gallery.app" not found at: /var/folders/07/rvgsd3wx7_949217htsn84pw0000gn/T/Gallery.app
我知道制造商只将信息转发到appdmg库。我一直在浏览他们的文档,我发现所有这些都被视为相对路径。
基本上我不知道临时挂载位置是什么,我只想从内容对象中指定 x 和 y 变量,但它迫使我指定类型和路径。
有没有人改变过dmg风格?请高度赞赏任何帮助。
PD。当我在没有指定内容的情况下安装 dmg 然后添加如下内容时,此方法有效:
{ x: 192, y: 344, type: "file", path: "/Volumes/Gallery/Gallery.app" },
但是一旦我弹出它并更新伪造配置以包含上面的行,它就会中断。
解决方案
如果有人经历相同的 bs,只需使用process.cwd()
.
参见示例:
contents: [
{
x: 192,
y: 240,
type: "file",
path: `${process.cwd()}/out/Gallery-darwin-x64/Gallery.app`
},
{ x: 466, y: 240, type: "link", path: "/Applications" }
]
我终于可以玩转图标位置了!快乐编码。
推荐阅读
- regex - 根据模式删除txt文件中的行
- java - 单击项目后,如何在 RecyclerView 的适配器内从可绘制更改 imageView 的图像?
- javascript - 为每个领域反应 OnChange - 有没有更好的方法
- spring-mvc - Spring LocaleChangeInterceptor:如何拦截空语言参数?
- android - 如何在广播接收器中停止媒体播放器?
- reactjs - 图片在外部库中加载,如何使用 webpack 加载它们?
- bluetooth - BLE 上的制造商特定数据
- firebase - 如何使用服务器端查询从 Firebase 实时数据库中获取一些随机项目?
- java - 从 RethinkDB Count 对象中提取数据
- python - 如何在 python 中创建表?熊猫