JohnSundell / Files

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

Root subfolder parent is not root #74

Closed MaximeLM closed 5 years ago

MaximeLM commented 5 years ago

Hello,

let rootFolder = try Folder(path: "/")
let subfolder = rootFolder.subfolders.first
print(subfolder?.parent?.path)

Expected result: Optional("/") Actual result: current working directory

Because of this bug, iterating over a folder parents triggers an inifinite loop.

I will submit a pull request with the fix.