Consider use of System.IO.Enumeration
In .NET Core 2.1 there's a "advanced" file system enumeration API https://blogs.msdn.microsoft.com/jeremykuhne/2018/03/09/custom-directory-enumeration-in-net-core-2-1/ that is faster and more customizable.
Perhaps this would be interesting to use if available, especially since .NET Core itself does not yet have advanced globbing functionality.
This seems like a good suggestion. I would be open to discussing an implementation/API for this and greatly appreciation any contributions.
This seems interesting but until these APIs are available in .NET standard I don't think it make sense for this project at this time. Thanks
Makes sense. It's expected in.NET Standard 2.1: https://github.com/dotnet/standard/pull/820
I am subscribed to that PR 😄 I will keep an eye on it.
@danmosemsft I was looking at the code for the System.IO.Enumeration APIs and I noticed that there are bits of code like:
#if MS_IO_REDIST
namespace Microsoft.IO.Enumeration
#else
namespace System.IO.Enumeration
#endif
As far as I can tell those allow usage from .NET Framework 4.7.2. Is that correct? If I wanted to use the file system enumeration API in .NET Framework 4.7.2 would I need to add a package for Microsoft.IO.Redist?
I think so - looks like it's in nuget. https://www.nuget.org/packages/Microsoft.IO.Redist
Since our focus is.NET Core if you found a bug that was specific to.NET Framework we might not be able to fix it, but it's open source and as far as I know it would work fine. @jeremykuhne owns this - Jeremy any known issues with the package on.NET Framework?
@kthompson No known issues. :) That package is specifically for 4.7.2. Let me know if you have any problems with it.
@JeremyKuhne the only thing I noticed is that all of the FileSystemInfo, DirectoryInfo, and FileInfo seemed to be from another namespace as well. Something like Microsoft.IO.FileInfo iirc. Is that to be expected? I was looking at incorporating the use of System.IO.Enumeration but I wanted to keep support for .NET Framework as well but it seemed odd to me that those types have a different namespace rather than the same one from .NET Framework(making them effectively different types).
@kthompson that is by design as they are different types. The library doesn't include everything in System.IO- the key thing it doesn't have is FileStream. FileStream on 4.7.2 will work with long paths and the like- you can either manifest and enable the reg key in Windows or simply prepend with \\?\ when creating FileStreams (after calling M.IO.Path.GetFullPath()).
@JeremyKuhne Ok. I don't think it will be a major issue for users of this library on .NET Framework to use Microsoft.IO.Redist as there will be a couple breaking changes anyways. I will just need to make the ifdefs to use M.IO rather than System.IO for .NET Framework. Thanks for the feedback.