uncPath = System.IO.Path.GetPublicPath( originalPath as string )
localPath = System.IO.Path.GetLocalPath( originalPath as string )
This is constantly a bugger in distributed systems. When saving the full path to a file, say, in a database, one likes to store a public name. Using the most publicly accessible UNC path. But, to succeed to do so, even if it means using administrative
shares (i.e. D$ for D: drive). In this way, when building distributed systems, components running on remote computers can find the file. Thus the need for GetPublicPath.
But when you actually go to processing, and you use UNC paths, I have found file access to take longer than when using a purely local path (if possible,... if indeed the file is local). GetLocalPath resolves to simple, non UNC type path names using simple
drive letters when possible. But if the file is not local, then it may not change the input path at all. GetLocalPath gives me the most optimal path to the file, given where I am at. Avoiding network elements in the path, when possible.
I have written these for myself, and use them constantly, and am confounded that they don't exist in the framework.
My routines even have the ability to accept a second parameter, which is a computer name, so I can say, calculate a path that would be local, not at the computer I am running from,
View Complete Post