Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alberti42 committed Sep 22, 2024
1 parent 1531080 commit 5fafb29
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/patchFileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ function patchFilemanager(plugin: ImportAttachments) {
}

// In case the attachment folder still exists and it is empty, delete it
if(parent) {
if(plugin.matchAttachmentFolder(parent.path)){ // of the type of an attachment folder
if(parent.children.length===0) { // attachment folder is empty
// const recursive = true;
// plugin.app.vault.delete(parent,recursive);
const postDescription = createEl('p',{text: "The attachment folder is now empty, and it should be safe to delete it."});
await deleteAttachmentFolderAssociatedWithMdFile(plugin, parent, undefined, postDescription);

if(plugin.settings.deleteAttachmentFolderWhenEmpty) {
if(parent) {
if(plugin.matchAttachmentFolder(parent.path)){ // of the type of an attachment folder
if(parent.children.length===0) { // attachment folder is empty
// const recursive = true;
// plugin.app.vault.delete(parent,recursive);
const postDescription = createEl('p',{text: "The attachment folder is now empty, and it should be safe to delete it."});
await deleteAttachmentFolderAssociatedWithMdFile(plugin, parent, undefined, postDescription);

}
}
}
}
Expand Down

0 comments on commit 5fafb29

Please sign in to comment.