Boost logo

Boost Users :

Subject: Re: [Boost-users] Program Options of Filesystem Path's - confused!
From: Daniel James (dnljms_at_[hidden])
Date: 2010-08-14 05:56:18

On 14 August 2010 06:35, Vladimir Prus <vladimir_at_[hidden]> wrote:
> John Dlugosz wrote:
>> A little experimenting tells me that it doesn't like having spaces in the string!  Note that the
>> quotes are understood by the run-time library that calls main, so the whole string (without
>> surrounding quotes) is present in one element of argv.  It works just fine when taking the
>> argument as a string.
>> This seems like a bug, somewhere.
> Try:
>        lexical_cast<fs::wpath>(fs::wpath("the path that fails"))
> If that fails, it means operator>> is mishandling spaces in paths.

If this filesystem v2 or v3? In filesystem v3, the stream extractor
uses whitespace as a separator (correctly IMO), so filenames with
spaces have to be quoted. I suspect the issue is that the filename has
already have been unquoted by the shell.

Your test will work, since the filename is quoted as it's written to
the stream, and then unquoted as it's extracted. But you'll see the
error with:

    lexical_cast<fs::wpath>("the path that fails")

Does program options ever do that?

Btw. in filesystem v3, 'wpath' is just a typedef for 'path'.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at