std.path.getName(): Screwy by design?

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Tue Mar 1 08:04:52 PST 2011


On Tue, 01 Mar 2011 10:55:57 -0500, Steven Schveighoffer wrote:

> On Tue, 01 Mar 2011 10:52:43 -0500, Lars T. Kyllingstad
> <public at kyllingen.nospamnet> wrote:
> 
>> On Tue, 01 Mar 2011 10:27:49 -0500, Steven Schveighoffer wrote:
> 
>>> very very smart, experienced people sometimes do things without
>>> thinking. If we can do something really small to prevent catastrophic
>>> errors, I think it's worth it.  I think in close to 100% of cases, one
>>> never wants a file with \ or * in it, so the library disallowing it
>>> will not cause any issues.
>>
>> Wait... are we still discussing the merits of various file systems, or
>> are we now debating how Phobos should handle weird filenames?
> 
> The point of this whole discussion is how should phobos' std.path deal
> with filenames.  I thought that was implied.

But std.path doesn't have to deal with these issues.  std.path is 
basically a bunch of functions that search for '/', '\' or '.' in some 
string.  The only special case it needs to worry about is that '\' is an 
ordinary character on POSIX and a dir separator on Windows.

If you want to disallow creating files named "-rf *", that'll have to be 
done in std.stdio and std.file.

-Lars


More information about the Digitalmars-d mailing list