Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/bruno-electron/src/ipc/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) {
Expand Down