open top level Explore by default

This commit is contained in:
James Browning
2024-10-23 16:04:49 +01:00
parent ff90e84a85
commit 38fa72a8ca

View File

@@ -126,13 +126,15 @@ export class FileNode {
* @param collapsed default state of folders (collapsed by default or not)
* @returns array containing folder state for tree
*/
getFolderPaths(collapsed: boolean): FolderState[] {
getFolderPaths(collapseSubFolders: boolean): FolderState[] {
const folderPaths: FolderState[] = []
const traverse = (node: FileNode, currentPath: string) => {
if (!node.file) {
const folderPath = joinSegments(currentPath, node.name)
if (folderPath !== "") {
// If the folder is at the top level, open it by default
const collapsed = node.depth === 1 ? false : collapseSubFolders
folderPaths.push({ path: folderPath, collapsed })
}