Proposal for std.path replacement

Nick Sabalausky a at a.a
Mon Mar 7 14:51:12 PST 2011


"Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message 
news:il2hsp$89d$2 at digitalmars.com...
> On Mon, 07 Mar 2011 10:25:21 +0000, Regan Heath wrote:
>
>> On Sun, 06 Mar 2011 08:37:15 -0000, Rainer Schuetze <r.sagitario at gmx.de>
>> wrote:
>>
>>> Looks good overall. I have a few comments and nitpicks though:
>>>
>>>  >   basename("dir/subdir/")             -->  "subdir"
>>>  >   directory("dir/subdir/")      -->  "dir"
>>>
>>> Is this what everybody expects? I'm not sure, but another possibility
>>> would be to treat these as if "dir/subdir/." is passed. What is the
>>> result of directory("/") or directory("d:/")?
>>
>> ?? I would expect:
>>
>>    directory("dir/subdir/")      -->  "dir/subdir"
>>
>> as subdir _is_ a dir, not a file, as shown by the trailing slash.  If it
>> was:
>>
>>    directory("dir/subdir")      -->  "dir"
>>
>> as subdir is perhaps not a directory, as there is no trailing slash.
>>
>> I realise this means the trailing slash becomes important, but it kinda
>> is important as it does tell us when something is definitely a
>> directory.
>
> I don't think it does, or rather, I don't think there is such a thing as
> "definitely a directory".  What about a symlink to a directory, for
> instance?  On one hand, it *is* a file that contains a reference to a
> directory, and on the other, in most respects it *acts like* a directory.
>
> You can even argue that a "file" is simply the term used for a node in
> the filesystem tree, and that "directory" is a special kind of file that
> contains a list of other files.  This terminology is pretty standard in
> *NIX land, at least.  (Just google "everything is a file".)
>

That's true on windows too:

"Note that a directory is simply a file with a special attribute designating 
it as a directory..."
http://msdn.microsoft.com/en-us/library/aa365247%28v=VS.85%29.aspx#file_and_directory_names





More information about the Digitalmars-d mailing list