Weird Windows Error: The File Already Exists
I ran into a very strange Windows error a while back. It started when I tried to make a commit in GitHub for Windows and got an error message....
I ran into a very strange Windows error a while back. It started when I tried to make a commit in GitHub for Windows and got an error message....
For some odd reason, System.IO doesn’t include a method to get the UNC path for a file or directory. Even stranger, many code samples resort to using p/invoke in order to get that information. But then I came across this StackOverflow answer that explained a pure .NET way to do the same thing. I gave the original code a good refactoring and turned it into the extension method below. While the most obvious place to stick something like this is the Path class, since it’s static that’s not possible....