修复默认图标错误问题

This commit is contained in:
Tlntin
2022-12-29 11:45:35 +08:00
parent 7980ea8823
commit f11b03d13c
2 changed files with 7 additions and 1 deletions

View File

@@ -195,18 +195,21 @@ export async function mergeTauriConfig(
} else {
updateIconPath = false;
logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
}
}
if (process.platform === "linux") {
if (customIconExt != ".png") {
updateIconPath = false;
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
}
}
if (process.platform === "darwin" && customIconExt !== ".icns") {
updateIconPath = false;
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
}
if (updateIconPath) {
tauriConf.tauri.bundle.icon = [options.icon];

5
dist/cli.js vendored
View File

@@ -1766,7 +1766,7 @@ function mergeTauriConfig(url, options, tauriConf) {
tauriConf.tauri.bundle.identifier = identifier;
// 删除映射关系
if (process.platform === "linux") {
delete tauriConf.tauri.bundle.deb.files;
tauriConf.tauri.bundle.deb.files = [];
}
// 处理应用图标
const exists = yield fs$1.stat(options.icon)
@@ -1784,17 +1784,20 @@ function mergeTauriConfig(url, options, tauriConf) {
else {
updateIconPath = false;
logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
}
}
if (process.platform === "linux") {
if (customIconExt != ".png") {
updateIconPath = false;
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
}
}
if (process.platform === "darwin" && customIconExt !== ".icns") {
updateIconPath = false;
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
}
if (updateIconPath) {
tauriConf.tauri.bundle.icon = [options.icon];