Skip to content

Commit 9c987f0

Browse files
ericodingclaude
andcommitted
fix(assets): regenerate ICO file and add icon cache clear utilities
- Regenerate icon.ico with proper ICO format using PIL - Add clear-icon-cache.bat script to clear Windows icon cache - Add comprehensive troubleshooting guide for icon display issues The previous icon.ico was actually a PNG file which caused Tauri build errors. Now properly converted from icon.png (1266x1227) to multi-resolution ICO format with sizes: 256x256, 128x128, 64x64, 48x48, 32x32, 16x16. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b956288 commit 9c987f0

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

clear-icon-cache.bat

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@echo off
2+
echo Clearing Windows Icon Cache...
3+
echo.
4+
echo This will close Explorer and clear the icon cache.
5+
echo Press Ctrl+C to cancel, or any other key to continue...
6+
pause > nul
7+
8+
echo.
9+
echo Stopping Explorer...
10+
taskkill /f /im explorer.exe
11+
12+
echo.
13+
echo Deleting icon cache...
14+
cd /d "%userprofile%\AppData\Local\Microsoft\Windows\Explorer"
15+
attrib -h IconCache.db
16+
del IconCache.db
17+
del iconcache_*.db 2>nul
18+
del thumbcache_*.db 2>nul
19+
20+
echo.
21+
echo Restarting Explorer...
22+
start explorer.exe
23+
24+
echo.
25+
echo Icon cache cleared successfully!
26+
echo Please reinstall the application to see the new icon.
27+
echo.
28+
pause

src-tauri/icons/icon.ico

116 KB
Binary file not shown.

图标显示问题解决方案.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Windows 应用图标显示问题解决方案
2+
3+
## 问题说明
4+
重新安装应用后,Windows 可能仍显示旧图标或默认图标。这是因为 Windows 会缓存应用程序图标。
5+
6+
## 已完成的修复
7+
1. ✅ 将错误的 PNG 格式的 icon.ico 转换为真正的 ICO 格式
8+
2. ✅ 生成多尺寸 ICO 文件(256x256, 128x128, 64x64, 48x48, 32x32, 16x16)
9+
3. ✅ 重新构建应用程序,图标已正确嵌入
10+
11+
## 解决方案:清理 Windows 图标缓存
12+
13+
### 方法1:使用提供的批处理脚本(推荐)
14+
15+
1. 关闭所有正在运行的 Pyra 实例
16+
2. 卸载当前安装的 Pyra 应用
17+
3. 运行项目根目录下的 `clear-icon-cache.bat` 脚本
18+
4. 重新安装新构建的安装包:
19+
- `src-tauri/target/release/bundle/nsis/Pyra_0.1.0_x64-setup.exe` (NSIS 安装程序)
20+
-`src-tauri/target/release/bundle/msi/Pyra_0.1.0_x64_zh-CN.msi` (中文 MSI)
21+
-`src-tauri/target/release/bundle/msi/Pyra_0.1.0_x64_en-US.msi` (英文 MSI)
22+
23+
### 方法2:手动清理图标缓存
24+
25+
如果脚本无法运行,可以手动操作:
26+
27+
1. 关闭所有 Pyra 实例并卸载应用
28+
2. 打开任务管理器(Ctrl+Shift+Esc)
29+
3. 找到"Windows 资源管理器"进程,右键选择"结束任务"
30+
4. 点击任务管理器菜单"文件" > "运行新任务"
31+
5. 输入:`%localappdata%\Microsoft\Windows\Explorer` 并回车
32+
6. 删除以下文件(如果存在):
33+
- IconCache.db
34+
- iconcache_*.db
35+
- thumbcache_*.db
36+
7. 在任务管理器中点击"文件" > "运行新任务",输入 `explorer.exe` 重启资源管理器
37+
8. 重新安装 Pyra
38+
39+
### 方法3:使用 PowerShell 命令
40+
41+
在管理员权限的 PowerShell 中运行:
42+
43+
```powershell
44+
# 停止 Explorer
45+
Stop-Process -Name explorer -Force
46+
47+
# 删除图标缓存
48+
Remove-Item "$env:LOCALAPPDATA\Microsoft\Windows\Explorer\IconCache.db" -Force -ErrorAction SilentlyContinue
49+
Remove-Item "$env:LOCALAPPDATA\Microsoft\Windows\Explorer\iconcache_*.db" -Force -ErrorAction SilentlyContinue
50+
Remove-Item "$env:LOCALAPPDATA\Microsoft\Windows\Explorer\thumbcache_*.db" -Force -ErrorAction SilentlyContinue
51+
52+
# 重启 Explorer
53+
Start-Process explorer.exe
54+
```
55+
56+
## 验证图标是否正确
57+
58+
安装完成后:
59+
1. 检查桌面快捷方式图标
60+
2. 检查开始菜单中的应用图标
61+
3. 检查任务栏中运行时的图标
62+
4. 检查应用窗口左上角的图标
63+
64+
## 如果问题仍然存在
65+
66+
如果清理缓存后图标仍不显示:
67+
68+
1. 重启计算机
69+
2. 确保完全卸载旧版本
70+
3. 使用管理员权限运行安装程序
71+
4. 检查 `src-tauri/icons/icon.ico` 文件是否正确(应为 149KB 的 ICO 格式文件)
72+
73+
## 技术细节
74+
75+
- 图标文件位置:`src-tauri/icons/icon.ico`
76+
- 图标格式:ICO(包含 6 种尺寸)
77+
- 配置文件:`src-tauri/tauri.conf.json`
78+
- 安装包位置:`src-tauri/target/release/bundle/`
79+
80+
## 源图标文件
81+
82+
高分辨率源文件保存在:`src-tauri/icons/icon.png` (1266x1227 像素)
83+
如需重新生成 ICO,可使用:
84+
85+
```bash
86+
python -c "from PIL import Image; img = Image.open('src-tauri/icons/icon.png'); img.save('src-tauri/icons/icon.ico', format='ICO', sizes=[(256,256), (128,128), (64,64), (48,48), (32,32), (16,16)])"
87+
```

0 commit comments

Comments
 (0)