JohnSundell / Files

A nicer way to handle files & folders in Swift
MIT License
2.53k stars 182 forks source link

Moving a folder using move(to:) creates an invalid path #45

Closed clayellis closed 6 years ago

clayellis commented 6 years ago
  1. Create folder A
  2. Create folder B inside A
  3. Create folder C inside B
    .
    ├─ A
    └─ B
       └─ C
  4. Move B to same level as A
    .
    ├─ A
    ├─ B
    └─ C
  5. Try getting subfolder C with b.subfolder(named: "C") - error

Invalid path given: /Users/clay/.filesTest/BC/

This is because move(to:) removes the trailing / from the moved item's path. I'm submitting a PR that fixes this along with a test to catch this in the future.