|
|
@ -157,12 +157,13 @@ class FileProvider { |
|
|
|
* @param {*} path is the folder to be removed |
|
|
|
* @param {*} path is the folder to be removed |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
remove (path) { |
|
|
|
remove (path) { |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
path = this.removePrefix(path) |
|
|
|
path = this.removePrefix(path) |
|
|
|
if (window.remixFileSystem.existsSync(path)) { |
|
|
|
if (window.remixFileSystem.existsSync(path)) { |
|
|
|
const stat = window.remixFileSystem.statSync(path) |
|
|
|
const stat = window.remixFileSystem.statSync(path) |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (!stat.isDirectory()) { |
|
|
|
if (!stat.isDirectory()) { |
|
|
|
return this.removeFile(path) |
|
|
|
resolve(this.removeFile(path)) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const items = window.remixFileSystem.readdirSync(path) |
|
|
|
const items = window.remixFileSystem.readdirSync(path) |
|
|
|
if (items.length !== 0) { |
|
|
|
if (items.length !== 0) { |
|
|
@ -182,10 +183,11 @@ class FileProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
console.log(e) |
|
|
|
return false |
|
|
|
return resolve(false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true |
|
|
|
return resolve(true) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
removeFile (path) { |
|
|
|
removeFile (path) { |
|
|
|