Boost logo

Boost Users :

Subject: Re: [Boost-users] [filesystem] is path comparison case-insensitive on Windows?
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-06-15 17:02:41


> > > Isn't it what you
> > > want? http://www.boost.org/libs/filesystem/v3/doc/reference.html#equivalent
> >
> >
> > Not quite. Suppose I want to test whether a file has a "jpg" extension (case
> > insensitive on Windows). I would like to be able to do:
>
> That would be case insensitive on NTFS, not on all Windows file systems.

> > path file = ...;
> > path jpeg_ext = ".jpg";
> > ...
> > if (file.extension() == jpeg_ext)
> >
> > and have the comparison return true for "something.JPG" on Windows.
> >
> >
> > I can't do
> >
> > if (file.extension().equivalent(jpeg_ext))
> >
> > because equivalent() requires that one of the paths exists().
> >
> >
> > So what should I do instead?
> >
> > #if __WIN32__
> > if (iequals(file.extension().string(), jpeg_ext.string())
>
> You can't check whether a file system is case sensitive at compile time.

Good point. It just reinforces my point, which is that the library should
take care of this rather than the user having to.

Regards,
Nate

                                               


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net