Skip to content

Commit

Permalink
fix folder removal
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Jun 27, 2017
1 parent 5fee645 commit 9bfd3e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/file-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function fileExplorer (appAPI, files) {
if (isFolder) path += '/'
if (confirm(`Do you really want to delete "${path}" ?`)) {
li.parentElement.removeChild(li)
removeSubtree(files, path)
removeSubtree(files, path, isFolder)
}
}

Expand Down Expand Up @@ -343,7 +343,7 @@ function getLabelFrom (li) {
return li.children[0].children[1].children[0]
}

function removeSubtree (files, path) {
function removeSubtree (files, path, isFolder) {
var parts = path.split('/')
var isFile = parts[parts.length - 1].length
var removePaths = isFile ? [path] : Object.keys(files.list()).filter(keep)
Expand All @@ -357,6 +357,7 @@ function removeSubtree (files, path) {
})
files.remove(path)
})
if (isFolder) files.remove(path)
}

function expandPathTo (li) {
Expand Down

0 comments on commit 9bfd3e6

Please sign in to comment.