mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
debug(obsidian): add logging to diagnose nested folder display issue
- Add debug logging to getVaultFiles() to show file counts - Add logging to listAllNotes() to show processing details - Add logging to buildFolderTree() to trace folder creation - Filter .md files in getVaultFiles() for better performance - Log sample file paths to help diagnose API response format This will help identify why nested folders aren't appearing in the folder tree browser.
This commit is contained in:
parent
8561eee75d
commit
adb04d2e43
2 changed files with 24 additions and 1 deletions
|
|
@ -360,13 +360,18 @@ async function promptCreateNewNote(elementId, elementType, coordinates) {
|
|||
function buildFolderTree(notes) {
|
||||
const root = {folders: {}, files: []};
|
||||
|
||||
INFO && console.log(`buildFolderTree: Processing ${notes.length} notes`);
|
||||
|
||||
notes.forEach((note, index) => {
|
||||
const parts = note.path.split("/");
|
||||
const fileName = parts[parts.length - 1];
|
||||
|
||||
DEBUG && console.log(`Processing note ${index}: ${note.path} (${parts.length} parts)`);
|
||||
|
||||
if (parts.length === 1) {
|
||||
// Root level file
|
||||
root.files.push({name: fileName, index, path: note.path});
|
||||
DEBUG && console.log(` -> Added to root files: ${fileName}`);
|
||||
} else {
|
||||
// Navigate/create folder structure
|
||||
let current = root;
|
||||
|
|
@ -374,14 +379,18 @@ function buildFolderTree(notes) {
|
|||
const folderName = parts[i];
|
||||
if (!current.folders[folderName]) {
|
||||
current.folders[folderName] = {folders: {}, files: []};
|
||||
DEBUG && console.log(` -> Created folder: ${folderName}`);
|
||||
}
|
||||
current = current.folders[folderName];
|
||||
}
|
||||
// Add file to final folder
|
||||
current.files.push({name: fileName, index, path: note.path});
|
||||
DEBUG && console.log(` -> Added to folder: ${fileName}`);
|
||||
}
|
||||
});
|
||||
|
||||
INFO && console.log("Folder tree structure:", root);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue