UNC Pathname Handling within Applications

Shankar Unni shankarunni@netscape.net
Thu Jul 15 22:58:00 GMT 2004

Thorsten Haude wrote:

> - Is there any standard way to approach this problem? Has it come up
> before in other applications?

I don't know why you are even trying to normalize the paths like this. 
Just hand the thing off to the OS. Usually, both the user and the OS 
know what it is they are trying to do.

For your program to try to mediate between them, and try to "understand 
and correct" the user's request is almost always inappropriate.

Don't even try to normalize "\" to "/" or vice-versa. Windows APIs (the 
low-level ones) know perfectly well how to handle forward-slashes as 
directory separators..

> - Do you know a resource which explains how Posix apps are expected to
> handle paths like this?

It doesn't matter. Just pass the names, as is, to the underlying OS API.

POSIX specifically says that *two* leading slashes "implementation 
defined" behavior, and this is specifically to allow NetBIOS-like (and 
AFS-like) names in POSIX implementations.

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list