X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Subject: POSIX names for drive letters Date: Fri, 25 Aug 2006 09:57:58 +0200 Message-ID: In-Reply-To: <44EC423D.7020807@student.lu.se> From: "Schwarz, Konrad" To: "MSYS Discussion List" , Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k7P7x1sK009447 Hi, I know that it is kind of late :-), but I would like to suggest an alternative/additional mapping of drive letters to the MinGW and Cygwin file-system name space. The proposed mapping for directory `C:\' is `//./C$/' (or perhaps `//./C/'). The reasons for this mapping are: * POSIX allows paths that begin with exactly two slashes to be "special": they do not have to obey normal file system path semantics (see XBD 4.11). E.g., POSIX requires `/x/my_file' to be referenced from `/y/my_dir' as `../../x/my_file', but this is does not work in MinGW. By beginning the path with two slashes, POSIX compliant code knows that this transformation should not be attempted in general. * The notation `//./something' is in line with standard Windows API names for system devices. See the documentation for the CreateFile() function in the Windows SDK for those names. In particular, CreateFile() uses `\\.\C:\' to represent the root directory of that volume and `\\.\C:' to represent the volume (raw device). Since colon is used in POSIX to separate paths in the PATH environment variable, `//./C:/' is not a good mapping. * The notation is in line with the Windows Universal Naming Convention (UNC) insofar as it consists of two components and begins with two directory separation characters. Therefore, Windows-special cased code that does not need to differentiate between "local" and "network" drives (which should be the majority of cases) can stay unaware of the differentiation. * `//host/C$' is the standard share name for drives under Windows that are mounted from a different machine. * Shells do not attempt to expand the substring `$/' as a variable. Other languages, e.g., make(1), will attempt to expand such a reference, so `//./C/' might be better than `//./C$/'. `//./C/' also has the benefit of using only letters from the POSIX portable filename character set. However, `//./C/' might be used by Microsoft for some different purpose in the future. Note that for Windows, `/' is a reserved letter in the file system. It is, as far as I know, never a problem to replace `\' with `/' in paths when dealing directly with the operating system (cmd.exe is something else), and the Windows SDK functions will even do this for you, except for paths prefixed with '\\?\'. Regards, Konrad Schwarz -- 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/