Commit 9bfd3e65 authored by yann300's avatar yann300

fix folder removal

parent 5fee645c
...@@ -183,7 +183,7 @@ function fileExplorer (appAPI, files) { ...@@ -183,7 +183,7 @@ function fileExplorer (appAPI, files) {
if (isFolder) path += '/' if (isFolder) path += '/'
if (confirm(`Do you really want to delete "${path}" ?`)) { if (confirm(`Do you really want to delete "${path}" ?`)) {
li.parentElement.removeChild(li) li.parentElement.removeChild(li)
removeSubtree(files, path) removeSubtree(files, path, isFolder)
} }
} }
...@@ -343,7 +343,7 @@ function getLabelFrom (li) { ...@@ -343,7 +343,7 @@ function getLabelFrom (li) {
return li.children[0].children[1].children[0] return li.children[0].children[1].children[0]
} }
function removeSubtree (files, path) { function removeSubtree (files, path, isFolder) {
var parts = path.split('/') var parts = path.split('/')
var isFile = parts[parts.length - 1].length var isFile = parts[parts.length - 1].length
var removePaths = isFile ? [path] : Object.keys(files.list()).filter(keep) var removePaths = isFile ? [path] : Object.keys(files.list()).filter(keep)
...@@ -357,6 +357,7 @@ function removeSubtree (files, path) { ...@@ -357,6 +357,7 @@ function removeSubtree (files, path) {
}) })
files.remove(path) files.remove(path)
}) })
if (isFolder) files.remove(path)
} }
function expandPathTo (li) { function expandPathTo (li) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment