Boost logo

Boost Users :

Subject: Re: [Boost-users] Program Options of Filesystem Path's - confused!
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2010-08-14 06:08:13

Daniel James wrote:

> 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?

Yes, of course. It takes string from command line, and does lexical_cast on it.
So, it seems like the only approach is to specialize lexical_cast for wpath/path?

- Volodya

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