From 6b3fcb9033c6d9c18c6add468a6beb157483b2b0 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Wed, 14 Oct 2009 04:32:54 +0000 Subject: Add a comment to file_path.h describing a couple of bits of trivia that came up today. We should have these documented. Now we do. BUG=0 TEST={} Review URL: http://codereview.chromium.org/274043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28946 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_path.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'base/file_path.h') diff --git a/base/file_path.h b/base/file_path.h index 672d589..7106c90b 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -20,6 +20,8 @@ // Linux does not specify an encoding, but in practice, the locale's // character set may be used. // +// For more arcane bits of path trivia, see below. +// // FilePath objects are intended to be used anywhere paths are. An // application may pass FilePath objects around internally, masking the // underlying differences between systems, only differing in implementation @@ -68,6 +70,32 @@ // RTL UI. // // This is a very common source of bugs, please try to keep this in mind. +// +// ARCANE BITS OF PATH TRIVIA +// +// - A double leading slash is actually part of the POSIX standard. Systems +// are allowed to treat // as an alternate root, as Windows does for UNC +// (network share) paths. Most POSIX systems don't do anything special +// with two leading slashes, but FilePath handles this case properly +// in case it ever comes across such a system. FilePath needs this support +// for Windows UNC paths, anyway. +// References: +// The Open Group Base Specifications Issue 7, sections 3.266 ("Pathname") +// and 4.12 ("Pathname Resolution"), available at: +// http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_266 +// http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12 +// +// - Windows treats c:\\ the same way it treats \\. This was intended to +// allow older applications that require drive letters to support UNC paths +// like \\server\share\path, by permitting c:\\server\share\path as an +// equivalent. Since the OS treats these paths specially, FilePath needs +// to do the same. Since Windows can use either / or \ as the separator, +// FilePath treats c://, c:\\, //, and \\ all equivalently. +// Reference: +// The Old New Thing, "Why is a drive letter permitted in front of UNC +// paths (sometimes)?", available at: +// http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx + #ifndef BASE_FILE_PATH_H_ #define BASE_FILE_PATH_H_ -- cgit v1.1