feat: aggiunge drag & drop di cartelle e file zip per lo smistamento

This commit is contained in:
2026-03-05 16:30:03 +01:00
parent 4ab1214171
commit 8edc2673b3
4 changed files with 110 additions and 0 deletions

24
main.js
View File

@@ -101,6 +101,30 @@ ipcMain.handle('select-zip', async () => {
return { canceled: false, ...routingResult };
});
ipcMain.handle('process-dropped-path', async (_event, payload) => {
const droppedPath = String(payload?.path || '').trim();
if (!droppedPath) {
throw new Error('Percorso non valido');
}
const stats = await fs.stat(droppedPath).catch(() => null);
if (!stats) {
throw new Error('Percorso non trovato');
}
if (stats.isDirectory()) {
const routingResult = await processFolder(droppedPath, config);
return { canceled: false, sourceType: 'folder', ...routingResult };
}
if (stats.isFile() && path.extname(droppedPath).toLowerCase() === '.zip') {
const routingResult = await processZip(droppedPath, config);
return { canceled: false, sourceType: 'zip', ...routingResult };
}
throw new Error('Trascina una cartella o un file .zip');
});
ipcMain.handle('get-destination', async () => ({
destination: config.destination || DEFAULT_DESTINATION,
}));