mirror of
https://github.com/Hommy-master/capcut-mate.git
synced 2026-09-03 06:25:40 +08:00
解决桌面图标异常的问题。
This commit is contained in:
@@ -6,6 +6,11 @@ const logger = require('./nodeapi/logger');
|
||||
const { setupIpcHandlers } = require('./nodeapi/ipcHandlers');
|
||||
const { attachEditContextMenu } = require('./nodeapi/editContextMenu');
|
||||
|
||||
// Windows 任务栏 / 快捷方式图标依赖 AppUserModelId,需与 electron-builder appId 一致
|
||||
if (process.platform === 'win32') {
|
||||
app.setAppUserModelId('com.gogoshine.capcut-mate');
|
||||
}
|
||||
|
||||
let mainWindow;
|
||||
let ipcHandlersInitialized = false;
|
||||
|
||||
|
||||
27
desktop-client/scripts/afterPackWinIcon.js
Normal file
27
desktop-client/scripts/afterPackWinIcon.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* electron-builder 在 signAndEditExecutable=false 时不会把 .ico 写入 exe。
|
||||
* 用 resedit(Node 实现,不依赖 winCodeSign)补回桌面 / 任务栏图标。
|
||||
*/
|
||||
module.exports = async function afterPackWinIcon(context) {
|
||||
if (context.electronPlatformName !== 'win32') {
|
||||
return;
|
||||
}
|
||||
|
||||
const exeName = `${context.packager.appInfo.productFilename}.exe`;
|
||||
const exePath = path.join(context.appOutDir, exeName);
|
||||
const iconPath = path.resolve(__dirname, '../assets/icons/logo.ico');
|
||||
|
||||
if (!fs.existsSync(exePath)) {
|
||||
throw new Error(`Windows executable not found: ${exePath}`);
|
||||
}
|
||||
if (!fs.existsSync(iconPath)) {
|
||||
throw new Error(`Windows icon not found: ${iconPath}`);
|
||||
}
|
||||
|
||||
const { resedit } = require('@electron/packager/dist/resedit');
|
||||
await resedit(exePath, { iconPath });
|
||||
console.log(`Embedded Windows icon into ${exeName}`);
|
||||
};
|
||||
@@ -4,6 +4,7 @@ module.exports = {
|
||||
directories: {
|
||||
output: "dist"
|
||||
},
|
||||
afterPack: require("./afterPackWinIcon"),
|
||||
win: {
|
||||
icon: "assets/icons/logo.ico",
|
||||
artifactName: "capcut-mate-windows-x64-green.zip",
|
||||
|
||||
@@ -7,6 +7,7 @@ module.exports = {
|
||||
directories: {
|
||||
output: "dist"
|
||||
},
|
||||
afterPack: require("./afterPackWinIcon"),
|
||||
files: [
|
||||
"**/*",
|
||||
// "!node_modules",
|
||||
@@ -23,7 +24,7 @@ module.exports = {
|
||||
icon: "assets/icons/logo.ico",
|
||||
target: "nsis",
|
||||
artifactName: "capcut-mate-windows-x64-installer.exe",
|
||||
// 禁用代码签名(避免本机无符号链接权限时解压 winCodeSign 失败)
|
||||
// 跳过 winCodeSign(本机解压会因符号链接权限失败);exe 图标由 afterPack 写入
|
||||
signingHashAlgorithms: [],
|
||||
signAndEditExecutable: false,
|
||||
signDlls: false
|
||||
@@ -31,6 +32,9 @@ module.exports = {
|
||||
nsis: {
|
||||
oneClick: false,
|
||||
allowToChangeInstallationDirectory: true,
|
||||
installerIcon: "assets/icons/logo.ico",
|
||||
uninstallerIcon: "assets/icons/logo.ico",
|
||||
shortcutName: "剪映小助手",
|
||||
},
|
||||
mac: {
|
||||
icon: "assets/icons/logo.icns",
|
||||
|
||||
Reference in New Issue
Block a user