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

Daniel Gibson metalcaedes at gmail.com
Tue Mar 1 13:57:59 PST 2011


Am 01.03.2011 22:42, schrieb Nick Sabalausky:
> "Daniel Gibson" <metalcaedes at gmail.com> wrote in message 
> news:ikivql$mbh$1 at digitalmars.com...
>> Am 01.03.2011 14:50, schrieb Nick Sabalausky:
>>> "Steven Schveighoffer"<schveiguy at yahoo.com>  wrote in message
>>> news:op.vrn2pooteav7ka at steve-laptop...
>>>> On Tue, 01 Mar 2011 08:13:33 -0500, Lars T. Kyllingstad
>>>> <public at kyllingen.nospamnet>  wrote:
>>>>
>>>>> On Tue, 01 Mar 2011 08:02:44 -0500, Steven Schveighoffer wrote:
>>>>>
>>>>>> On Tue, 01 Mar 2011 04:16:36 -0500, Jonathan M Davis
>>>>>> <jmdavisProg at gmx.com>  wrote:
>>>>>>
>>>>>>> I can understand if the path stuff
>>>>>>> can't deal with / or \ in file names (that's probably not worth 
>>>>>>> trying
>>>>>>> to get to
>>>>>>> work right), but it _should_ be able to handle directories with dots 
>>>>>>> in
>>>>>>> them and
>>>>>>> files with no extension.
>>>>>>
>>>>>> / and \ are not legal in names on any filesystem that I know of.
>>>>>>
>>>>>> -Steve
>>>>>
>>>>> On a *NIX machine, try
>>>>>
>>>>>    touch "c:\\foo\\bar"
>>>>>
>>>>> You may be surprised. ;)
>>>>
>>>> bleh... that seems useless :)  I purposely checked FAT before posting,
>>>> because I was sure Unix disallowed backslashes, I wanted to make sure 
>>>> FAT
>>>> didn't allow slashes.
>>>>
>>>> Holy crap, something that DOS got right and Unix didn't!
>>>
>>> Windows also handles files/paths with spaces a hell of a lot better than
>>> Unix. This, despite the fact that Unix technically allowed them long 
>>> before
>>> Windows did. (I don't mean this as OS-bashing.)
>>>
>>
>> It does? In what ways? In Unix you just have to escape spaces with 
>> backslashes or put the filename in "" and you're done (bash autocompletion 
>> does this). Don't think it's much simpler in Windows.
>> Filebrowsers (GUI or midnight commander etc) don't have any problems with 
>> spaces either.
>>
> 
> There's a long, seemingly-unending history of unix programs choking on paths 
> with spaces in them *even* when you give them the paths properly escaped. 
> Not all unix apps, but enough. I suppose maybe my experience or memory on 
> this is skewed, but I can't remember that ever happening to me on windows 
> except for apps that were ported from unix. Maybe things have changed within 
> the last few years, but try taking the source tree for some large unix 
> program, sticking it in a directory that has a space in the name, and 
> compiling it from there. I've had problems with that.
> 
> I think the main source of trouble is apps failing to properly escape spaces 
> when they, for instance, generate a script that acts on specific files or 
> when they send the filenames to another app via the commandline.
> 
> 

This is a problem of *programs* not dealing properly with spaces in
dir/file-names, but not of Unix itself.
I guess Windows developers just take more care of these issues than Unix
developers did, because spaces in file/dir-names are much more common in the
windows world.

Cheers,
- Daniel


More information about the Digitalmars-d mailing list