[🐛] Fixed folder deletion

This commit is contained in:
ThinLiquid 2024-01-10 13:15:55 +00:00
parent 8e04d6fcc7
commit cb1fad676f
No known key found for this signature in database
GPG key ID: D5085759953E6CAA
2 changed files with 6 additions and 2 deletions

2
package-lock.json generated
View file

@ -12,8 +12,8 @@
"@ptkdev/logger": "^1.8.0",
"eruda": "^3.0.1",
"filer": "^1.4.1",
"prism-code-editor": "^2.2.4",
"material-symbols": "^0.14.3",
"prism-code-editor": "^2.2.4",
"uuid": "^9.0.1"
},
"devDependencies": {

View file

@ -120,7 +120,11 @@ export default class FilesApp implements App {
}
}
(element.querySelector('.delete') as HTMLElement).onclick = async () => {
await window.fs.promises.unlink(dir + separator + file)
if (fileStat.isDirectory()) {
await window.fs.rmdir(dir + separator + file, () => {})
} else {
await window.fs.promises.unlink(dir + separator + file)
}
await setDir(dir)
}
element.ondblclick = async () => {