Proposal for std.path replacement

Nick Sabalausky a at a.a
Mon Mar 7 14:30:53 PST 2011


"Bekenn" <leaveme at alone.com> wrote in message 
news:il1h39$19p5$2 at digitalmars.com...
> On 3/6/2011 4:11 AM, Lars T. Kyllingstad wrote:
>>
>> Interestingly, it seems drive names are actually restricted to one
>> letter.  See the last paragraph of this section:
>>
>> http://en.wikipedia.org/wiki/Drive_letter#Common_assignments
>>
>> -Lars
>
> Correct.  However, the rules change for UNC paths: 
> http://msdn.microsoft.com/en-us/library/aa365247%28v=VS.85%29.aspx

Great link! I can't believe how much is in there that I never even had the 
slightest clue about. The '//?/' and '//./' are *completely* new to me, and 
I've been a windows guy since 3.11.

I think these parts are particularly relevent to our discussion here:

--------------------------------------------------
Do not end a file or directory name with a space or a period. Although the 
underlying file system may support such names, the Windows shell and user 
interface does not. However, it is acceptable to specify a period as the 
first character of a name. For example, ".temp".
--------------------------------------------------

This implies three things:

1. The windows shell and UI are shitty

2. The windows filesystem *does* allow files that end in '.' just lke unix, 
despite the windows shell and UI being too stupid to handle them right.

3. *Even on windows* something that starts with a dot is to be considered a 
filename, not a nameless file with an extension.

--------------------------------------------------
File I/O functions in the Windows API convert "/" to "\" as part of 
converting the name to an NT-style name, except when using the "\\?\" prefix 
as detailed in the following sections.
--------------------------------------------------

Ie, WinAPI automatically accepts *both* slashes and backslashes as the 
directory separator. Although lower-level stuff may expect backslashes.

-------------------------------------------------- 
{almost everything else}
--------------------------------------------------

Implies:

1. The ANSI/ASCII APIs should just simply *never* be used.

2. Handling all paths properly on windows is a royal fucking PITA.





More information about the Digitalmars-d mailing list