first commit
This commit is contained in:
42
verify-icon.js
Normal file
42
verify-icon.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('========================================');
|
||||
console.log('验证图标文件');
|
||||
console.log('========================================\n');
|
||||
|
||||
const iconPath = path.join(__dirname, 'build', 'icon.ico');
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!fs.existsSync(iconPath)) {
|
||||
console.error('[错误] 图标文件不存在:', iconPath);
|
||||
console.log('\n请确保:');
|
||||
console.log('1. build 文件夹存在');
|
||||
console.log('2. icon.ico 文件在 build 文件夹中');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 获取文件信息
|
||||
const stats = fs.statSync(iconPath);
|
||||
console.log('[OK] 图标文件存在');
|
||||
console.log('路径:', iconPath);
|
||||
console.log('大小:', stats.size, '字节');
|
||||
|
||||
// 检查文件内容(ICO 文件头)
|
||||
const buffer = Buffer.alloc(4);
|
||||
const fd = fs.openSync(iconPath, 'r');
|
||||
fs.readSync(fd, buffer, 0, 4, 0);
|
||||
fs.closeSync(fd);
|
||||
|
||||
// ICO 文件头应该是 00 00 01 00
|
||||
if (buffer[0] === 0x00 && buffer[1] === 0x00 &&
|
||||
buffer[2] === 0x01 && buffer[3] === 0x00) {
|
||||
console.log('[OK] 文件格式正确(ICO)');
|
||||
} else {
|
||||
console.error('[警告] 文件可能不是标准的 ICO 格式');
|
||||
console.log('文件头:', buffer.toString('hex'));
|
||||
}
|
||||
|
||||
console.log('\n========================================');
|
||||
console.log('验证完成!');
|
||||
console.log('========================================');
|
||||
Reference in New Issue
Block a user