pyfilesystem2
pyfilesystem2 copied to clipboard
Check path for `hassyspath` and use `shutil.rmdir` if True
Type of changes
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [x] Other
Checklist
- [ ] I've run the latest black with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [ ] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review :)
Description
Minor enhancement to removetree when the path has a syspath and so can be removed via shutil.rmtree
I think this is a good optimization, but we just need a few tests to make sure it is consistent with the current FS behaviour.
By the way, WrapReadOnly should be updated so that it makes the removetree method readonly, since this implementation does not use remove or removedir and could result in files being deleted even on a wrapped filesystem.