(folderPath: string, allowed = false, log = true)
| 151 | } |
| 152 | |
| 153 | deleteFolder(folderPath: string, allowed = false, log = true): FileSystem { |
| 154 | if(!allowed) { |
| 155 | throw new Error('It is necessary to manually allow to remove a folder through Vemto') |
| 156 | } |
| 157 | |
| 158 | if(this.folderIsRestrict(folderPath)) { |
| 159 | throw new Error('Attempt to delete a restricted directory') |
| 160 | } |
| 161 | |
| 162 | if(fs.existsSync(folderPath)) { |
| 163 | if(log) console.log('Removing Folder: ' + folderPath) |
| 164 | fs.rmdirSync(folderPath, { recursive: true }) |
| 165 | } |
| 166 | |
| 167 | return this |
| 168 | } |
| 169 | |
| 170 | folderIsRestrict(folderPath: string) { |
| 171 | const absolutePath = path.resolve(folderPath) |
nothing calls this directly
no test coverage detected