feat: aggiunge drag & drop di cartelle e file zip per lo smistamento
This commit is contained in:
24
main.js
24
main.js
@@ -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,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user