Cloning a dir now clone also folder.bru files recursively#2593 (#2596)

Co-authored-by: Fabio Grande <fabio.grande@hdhome.it>
This commit is contained in:
Fabio GRANDE 2024-07-10 07:54:49 +02:00 committed by GitHub
parent 58c8085a64
commit 240d2d03f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -534,6 +534,15 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
const folderPath = path.join(currentPath, item.name);
fs.mkdirSync(folderPath);
// If folder has a root element, then I should write its folder.bru file
if (item.root) {
const _folderContent = jsonToCollectionBru(item.root, true);
if (_folderContent) {
const _folderPath = path.join(folderPath, `folder.bru`);
fs.writeFileSync(_folderPath, _folderContent);
}
}
if (item.items && item.items.length) {
parseCollectionItems(item.items, folderPath);
}
@ -543,6 +552,15 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
await createDirectory(collectionPath);
// If initial folder has a root element, then I should write its folder.bru file
if (itemFolder.root) {
const _folderContent = jsonToCollectionBru(itemFolder.root, true);
if (_folderContent) {
const _folderPath = path.join(collectionPath, `folder.bru`);
fs.writeFileSync(_folderPath, _folderContent);
}
}
// create folder and files based on another folder
await parseCollectionItems(itemFolder.items, collectionPath);
} catch (error) {