
"David Daeschler" <daveregs@rsaisp.com> wrote in message news:d7n1to$rr7$1@sea.gmane.org...
Since the slash or slashes in that case are extraneous, I would also say option 2 is the way to go. Remove the trailing slash because it was probably not intended in the first place.
I don't believe removing a trailing slash is a good idea because that isn't how POSIX or Windows treats a trailing slash, and also because some apps may depend on it to distinguish between a directory path and a file path.
The only question I would have is about the path that is simply "//" or natively in the windows world "\\". In the windows command prompt changing to those two directories yields the following results.
C:\Documents and Settings\blah>cd \\ '\\' CMD does not support UNC paths as current directories.
and
C:\Documents and Settings\blah>cd \
C:\>
So if you were to trim the trailing slash in "//", it could potentially have different results in windows since it sees the "\\" as the beginning of a UNC path.
Leading double slashes have special meaning in both POSIX and Windows. Oddly, POSIX treats three or more leading slashes as a single slash. Three or more is just plain illegal in Windows. I didn't mention that in the original message to keep it simple, but those cases will have to be handled specially. --Beman