(basepath, id)
| 320 | } |
| 321 | |
| 322 | function deleteEmptySubdirs(basepath, id) { |
| 323 | // go through a list of potentially leftover directories |
| 324 | var idParts = id.split('/'); |
| 325 | var paths = idParts.map(function(part, index) { |
| 326 | return idParts.slice(0, index + 1).join('/'); |
| 327 | }).filter(function(part) { |
| 328 | return part.length > 0; |
| 329 | }); |
| 330 | paths.reverse(); |
| 331 | |
| 332 | // loop through the list and check if they're empty, then delete them |
| 333 | paths.forEach(function(pathPart) { |
| 334 | if (shell.ls('-R', path.join(basepath, 'resources', pathPart)).length === 0) { |
| 335 | shell.rm('-rf', path.join(basepath, 'resources', pathPart)); // delete empty directory |
| 336 | } |
| 337 | }); |
| 338 | } |
no outgoing calls
no test coverage detected