Boost logo

Boost :

From: Jason Stewart (res0054p_at_[hidden])
Date: 2002-01-24 16:58:27


At 09:29 PM 1/24/2002 +0000, you wrote:
>--- In boost_at_y..., "Stewart, Robert" <stewart_at_s...> wrote:
> > From: Carl Daniel [SMTP:cpdaniel_at_p...]
> > >
> > > From: "Stewart, Robert" <stewart_at_s...>
> > > > > - In DOS/Windows, pathnames are case insensitive, but they
>are stored
> > in
> > > > > upper case, so "norm_case" returns the wrong case. Other case
> > insensitive
> > > > > platforms may conventionally use lower case, so this should be
> > configurable.
> > >
> > > Not true. Windows filesystems since Windows 95 are case-
>insensitive,
> > case-preserving. Only Windows 3.1 era and earlier
> > > versions of DOS store directory/file name as uppercase.
> >
> > I don't think that's quite right either. Those OSes maintain two
>versions
> > of the filename if it was supplied using anything other than all
>upper case
> > or doesn't fit the 8.3 format. Command line tools in some of those
>versions
> > of Windows may even coerce the filename to all upper case if it
>fits the 8.3
> > format; I haven't tested that.

Windows will preserve case. Yes, there is a shortname but it is for
compatibility, not the primary way of storing it. To force all filenames on
Windows to be either upper or lowercase would be distasteful.

I have reworked the class that I submitted earlier (its not complete yet, I
just wanted to see what people thought about the interface).
http://stewart.simwright.net/samples/Pathname.h

I added two template parameters, the first one is basically a traits class
to tell it how to handle case. It has two comparison functions, equals and
less, and a transform function that can change the case. I provided 4
sample implementations, CaseSensitive, CaseInsensitive, Lowercase, and
Uppercase.

The second template parameter tells it how to handle the separator. It has
functions to compare a character to see if it is a valid separator, to
return the separator, to transform (i.e. force all forward slashes to
backslashes), and to check for duplicate separators (some platforms ignore
multiple separators, others don't).

Also, this class doesn't do much file I/O, it is solely for pathname
processing., not directory processing. From some of the other messages I've
read, people seem to feel this is the way to go.

Jason

>True.
>
> > The view given by Windows Explorer is different; it always shows
>directory
> > names with a leading capital and the rest lower case, unless the
>filename
> > was expressly set with a specific case that forces a "long"
>filename version
> > to be stored (such "long" names needn't be longer than 8.3). IOW,
>Windows
> > Explorer shows 8.3 directory names with a leading cap and shows
>those with a
> > long name entry using that long name.
>
>Not true. Explorer displays the "long file name", which may have any
>case. There's no requirement that the first letter be capitalized,
>and in fact most of my own files aren't named that way and appear
>with lowercase letters on my system.
>
>I believe there is a registry setting that causes explorer to init-
>cap file names when you first create them (and this may even be the
>default?), but you can always go back and change the case later even
>with this setting.
>
>Bill Kempf
>
>
>Info: http://www.boost.org Send unsubscribe requests to:
><mailto:boost-unsubscribe_at_[hidden]>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk