리펙토링: 전체 구조 검토, 개선

This commit is contained in:
2026-05-15 18:36:55 +09:00
parent 75a1f9e2f5
commit a1a5672d97
10 changed files with 117 additions and 23 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
const { ipcMain } = require('electron');
const path = require('path');
const fs = require('fs');
const crypto = require('crypto');
const EXTS = new Set(['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.tif', '.webp', '.heic', '.heif']);
@@ -12,7 +13,7 @@ function register() {
.map(f => {
const fullPath = path.join(folderPath, f);
const stat = fs.statSync(fullPath);
return { name: f, path: fullPath, mtime: stat.mtimeMs, size: stat.size };
return { name: f, path: fullPath, mtime: stat.mtimeMs };
})
.sort((a, b) => a.name.localeCompare(b.name, 'ko'));
return files;
@@ -78,7 +79,7 @@ function register() {
for (let i = 0; i < files.length; i++) {
const src = files[i].path;
const ext = path.extname(files[i].name).toLowerCase();
const tmp = path.join(folderPath, `__tmp_rename_${i}_${Date.now()}${ext}`);
const tmp = path.join(folderPath, `__tmp_${crypto.randomUUID()}${ext}`);
try {
fs.renameSync(src, tmp);
tmpMap.push({ tmp, ext, idx: i });
+1 -1
View File
@@ -53,7 +53,7 @@ function register(mainWindow) {
return { name: e.name, path: fullPath, hasChildren };
})
.sort((a, b) => a.name.localeCompare(b.name));
} catch { return []; }
} catch { return null; }
});
ipcMain.handle('reveal-folder', (_e, folderPath) => shell.openPath(folderPath));