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

Nick Sabalausky a at a.a
Tue Mar 1 05:15:36 PST 2011


"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
news:op.vrn06uqneav7ka at steve-laptop...
> 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.
>

Strictly speaking, most filesystems are perfectly capable of having any 
character in the filename, even control characters. I know that's definitely 
the case with FAT32 and NTFS. This has occasionally been used to create 
files that are a royal PITA to delete (either as a prank or as a malware 
technique). It's just that the software that interacts with the filesystem 
(possibly the filesystem driver itself) either can't always cope with 
certain characters or generally chooses to reject them before actually 
committing to the filesystem.

That said, there's no reason to bend over backwards trying to support such 
characters that *shouldn't* exist in file/path names, unless you're making a 
tool specifically designed to deal with that sort of thing (in which case 
you might need to bypass the usual IO APIs anyway).




More information about the Digitalmars-d mailing list