aspnet / FileSystem

[Archived] Abstraction of file system APIs. Project moved to https://github.com/aspnet/Extensions
Apache License 2.0
171 stars 82 forks source link

Support GetFileInfo for directories #298

Closed stilettk closed 6 years ago

stilettk commented 7 years ago

Currently GetFileInfo supports only files: when called on a path that points to a directory it returns PhysicalFileInfo which has IsDirectory == false.

So, when given a path, how to decide what to do: to call GetFileInfo (if it's a file) or call GetDirectoryContents (if it's a folder)? Currently the only way I found isn't very intuitive: bool isDirectory = fileProvider.GetDirectoryContents(myPath).Exists

My suggestion: new PhysicalFileProvider(myPath).GetFileInfo("data") Expected: PhysicalDirectoryInfo Actual: PhysicalFileInfo

aspnet-hello commented 6 years ago

This issue was moved to aspnet/Home#2537