41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const sourceDir = 'image';
|
|
const targetDir = 'src/static/icons';
|
|
|
|
const iconFiles = [
|
|
{ src: 'paper.png', dest: 'paper.png' },
|
|
{ src: 'metal.png', dest: 'metal.png' },
|
|
{ src: 'plastic.png', dest: 'plastic.png' },
|
|
{ src: 'fabric.png', dest: 'fabric.png' },
|
|
{ src: 'glass.png', dest: 'glass.png' }
|
|
];
|
|
|
|
iconFiles.forEach(item => {
|
|
const srcPath = path.join(sourceDir, item.src);
|
|
const destPath = path.join(targetDir, item.dest);
|
|
|
|
if (fs.existsSync(srcPath)) {
|
|
fs.copyFileSync(srcPath, destPath);
|
|
const stats = fs.statSync(srcPath);
|
|
console.log(`已复制: ${item.src} -> ${item.dest} (${stats.size} bytes)`);
|
|
} else {
|
|
console.log(`源文件不存在: ${srcPath}`);
|
|
}
|
|
});
|
|
|
|
console.log('\n✅ 图标文件复制完成!');
|
|
|
|
console.log('\n=== 检查目标目录图标文件 ===');
|
|
fs.readdir(targetDir, (err, files) => {
|
|
if (err) {
|
|
console.log('读取目录失败:', err);
|
|
return;
|
|
}
|
|
const iconFiles = files.filter(f => ['paper.png', 'metal.png', 'plastic.png', 'fabric.png', 'glass.png'].includes(f));
|
|
iconFiles.forEach(f => {
|
|
const stats = fs.statSync(path.join(targetDir, f));
|
|
console.log(`${f}: ${stats.size} bytes`);
|
|
});
|
|
}); |