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MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', |
|
|
|
permission: true, |
|
|
|
permission: true, |
|
|
|
version: packageJson.version, |
|
|
|
version: packageJson.version, |
|
|
|
methods: ['file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'unlink', 'rename', 'readdir', 'rmdir'], |
|
|
|
methods: ['file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'rename', 'readdir', 'remove'], |
|
|
|
kind: 'file-system' |
|
|
|
kind: 'file-system' |
|
|
|
} |
|
|
|
} |
|
|
|
const errorMsg = { |
|
|
|
const errorMsg = { |
|
|
@ -190,20 +190,6 @@ class FileManager extends Plugin { |
|
|
|
await this.writeFile(dest, content) |
|
|
|
await this.writeFile(dest, content) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Removes a file |
|
|
|
|
|
|
|
* @param {string} path path of the file to remove |
|
|
|
|
|
|
|
* @note will not work on a directory, use `rmdir` instead |
|
|
|
|
|
|
|
* @returns {void} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
async unlink (path) { |
|
|
|
|
|
|
|
await this._handleExists(path, `Cannot remove file ${path}`) |
|
|
|
|
|
|
|
await this._handleIsDir(path, `Cannot remove file ${path}`) |
|
|
|
|
|
|
|
const provider = this.fileProviderOf(path) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provider.removeFile(path) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Change the path of a file/directory |
|
|
|
* Change the path of a file/directory |
|
|
|
* @param {string} oldPath current path of the file/directory |
|
|
|
* @param {string} oldPath current path of the file/directory |
|
|
@ -251,15 +237,12 @@ class FileManager extends Plugin { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Removes a directory recursively |
|
|
|
* Removes a file or directory recursively |
|
|
|
* @param {string} path path of the directory to remove |
|
|
|
* @param {string} path path of the directory/file to remove |
|
|
|
* @note will not work on a file, use `unlink` instead |
|
|
|
|
|
|
|
* @returns {void} |
|
|
|
* @returns {void} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async rmdir (path) { |
|
|
|
async remove (path) { |
|
|
|
await this._handleExists(path, `Cannot remove directory ${path}`) |
|
|
|
await this._handleExists(path, `Cannot remove file or directory ${path}`) |
|
|
|
await this._handleIsDir(path, `Cannot remove directory ${path}`) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const provider = this.fileProviderOf(path) |
|
|
|
const provider = this.fileProviderOf(path) |
|
|
|
|
|
|
|
|
|
|
|
return await provider.remove(path) |
|
|
|
return await provider.remove(path) |
|
|
|