Path separator

Larry Hall cygwin-lh@cygwin.com
Wed Jun 4 02:42:00 GMT 2003


Greg Fenton wrote:
> --- Larry Hall <cygwin-lh@cygwin.com> wrote:
> 
>>Max is right (surprised Max? ;-) )  But I want to point out something
>>else about what you've said.  If your main concern is paths, don't
>>convert '/' to '\'.  Windows understands both under the hood. 
>>(Cygwin
>>does too but that's another matter).  However, this is the least of
>>your problems as Max clearly states.
>>
> 
> 
> 
> Yes, Max is right.  I hadn't thought about the difference between a
> "native win32" environment vs. "from a DOS prompt on a system that has
> Cygwin in its path" (I rarely, if ever, run in a "native win32"
> environment...)
> 
> I don't understand why we don't just get MSFT to ship cygwin1.dll... 
> :-)
> 
> One last point: not all flavours of Windows that are targetted for
> SWISH-E support the "/" vs. "\" (e.g. Win95/98).  At least, I don't
> think they support it...but again, its been a long while since I've sat
> in front of such a box.


 From the MSDN:

File Name Conventions
Although each file system can have specific rules about the formation of 
individual components in a directory or file name, all file systems follow the 
same general conventions: a base file name and an optional extension, separated 
by a period. For example, the MS-DOS FAT file system supports 8 characters for 
the base file name and 3 characters for the extension. This is known as an 8.3 
file name. The FAT file system and NTFS support file names that can be up to 255 
characters long. This is known as a long file name. To get an MS-DOS file name 
given a long file name, use the GetShortPathName function. To get the full path 
of a file, use the GetFullPathName function.

Both file systems use the backslash (\) character to separate directory names 
and the file name when forming a path.

General rules for applications creating names for directories and files or 
processing names supplied by the user include the following:

Use any character in the current code page for a name, but do not use a path 
separator, a character in the range 0 through 31, or any character explicitly 
disallowed by the file system. A name can contain characters in the extended 
character set (128–255).

Use the backslash (\), the forward slash (/), or both to separate components in 
a path. No other character is acceptable as a path separator. Note that UNC 
names must adhere to the following format: \\server\share.

.
.
.


So there may be a need to backslashify the UNC portion of a path.  Other
than that, forward slashes are fine.




-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746


--
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