🐛 Support Chinese naming and fix the use of local icons

This commit is contained in:
Tw93
2025-09-16 10:20:50 +08:00
parent dd11c6dd7a
commit 6aaa9a4517
4 changed files with 59 additions and 23 deletions

8
bin/options/icon.ts vendored
View File

@@ -43,9 +43,11 @@ const API_KEYS = {
/**
* Generates platform-specific icon paths and handles copying for Windows
*/
import { generateSafeFilename } from '@/utils/name';
function generateIconPath(appName: string, isDefault = false): string {
const safeName = appName.toLowerCase().replace(/[^a-z0-9-_]/g, '_');
const baseName = isDefault ? 'icon' : safeName;
const safeName = isDefault ? 'icon' : generateSafeFilename(appName).toLowerCase();
const baseName = safeName;
if (IS_WIN) {
return path.join(npmDirectory, 'src-tauri', 'png', `${baseName}_256.ico`);
@@ -122,7 +124,7 @@ async function convertIconFormat(
await fsExtra.ensureDir(platformOutputDir);
const processedInputPath = await preprocessIcon(inputPath);
const iconName = appName.toLowerCase();
const iconName = generateSafeFilename(appName).toLowerCase();
// Generate platform-specific format
if (IS_WIN) {