pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

Check path for `hassyspath` and use `shutil.rmdir` if True

Open geoffjukes opened this issue 5 years ago • 1 comments

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

geoffjukes avatar Sep 21 '20 23:09 geoffjukes

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.

althonos avatar Sep 22 '20 08:09 althonos