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

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 1 06:52:50 PST 2011


On Tue, 01 Mar 2011 09:31:18 -0500, Lars T. Kyllingstad  
<public at kyllingen.nospamnet> wrote:

> On Tue, 01 Mar 2011 08:50:29 -0500, Nick Sabalausky wrote:
>
>> "Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message

>>> From this page: http://en.wikipedia.org/wiki/Filename, it appears that
>>> really, the only disallowed character in unix filenames is '/'.  Even
>>> '*' is allowed as a filename.  How... horrible.
>> I would actually feel very good to just simply not support such things.
>> If some unix user is going to use such awful filenames they can just
>> deal with the consequences. (And I'm *rarely* the kind of person to hold
>> such a viewpoint on software development matters.)
>
> If you have a bunch of "reserved characters", that means more special
> cases to worry about in code.  I say it's better to allow as many
> characters as possible.

You still have to worry about them, because the shell treats them  
specially.

If there is a file named '*.d', and you type in rm *.d on the command  
line, guess what happens?

To make it really simple to accidentally create these things can cause big  
problems.

On the other hand, to not allow code that deals with filenames like that  
would mean you have to pull out a special toolkit to deal with them, or  
deal with the system calls directly.  I'm not sure that's the right  
approach either.

It would be nice to have a configuration that allows dealing with 'risky'  
characters, which is by default off.

-Steve


More information about the Digitalmars-d mailing list