Boost logo

Boost Users :

Subject: [Boost-users] Program Options of Filesystem Path's - confused!
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-08-13 13:11:58


OK, If I take a po:wvalue<std::wstring>()->notifier(&datadir_set)
the string gets passed to datadir_set, and within that function it implicitly converts the string to a fs::wpath instance to call set_me. It works as expected.

        void set_me (const fs::wpath& p);

        void datadir_set (const std::wstring& s)
         {
         wcout << L"** set data dir to " << s << L".\n";
         set_me (s);
         }


However, if I declare the program option as
        po::wvalue<fs::wpath>()->notifier(&set_me)

then when it runs I get "invalid option value". It apparently can't convert the argv token into a wpath? But it's not a compile-time error so it thinks it knows how to, but gets an error actually doing it?

I have no trouble passing long string literals to the constructor, e.g.
        fs::wpath f1 (L"C:\\here\\there.txt");

The program option takes "." on the command line just fine, so it's the specific value of the string it doesn't like! I tried with Unix-style slashes, with no difference.

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.

--John





TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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