title: Read relative file path with Boost Program options
body: <p>I'm working on a command line tool that can read options from:</p>
  
  <ul>
  <li>The command line arguments</li>
  <li>An optional configuration file</li>
  </ul>
  
  <p>I used <a href="http://www.boost.org/doc/libs/1_57_0/doc/html/program_options.html" rel="nofollow">Boost Program Options</a> to read those options and it works mostly fine.</p>
  
  <p>My code is like so:</p>
  
  <pre><code>namespace po = boost::program_options;
  namespace fs = boost::filesystem;
  
  po::variables_map vm;
  po::store(po::parse_command_line(argc, argv, options), vm);
  po::store(po::parse_config_file(ifs, options, true), vm);
  po::notify(vm);
  </code></pre>
  
  <p>However, some of these options are file path and I'd like those to be relative to the origin of the option. Here is an example of what I mean:</p>
  
  <p>Let's say my tool is located in: <code>/usr/local/bin</code></p>
  
  <pre><code>mytool --foo.path ../config/assets/toto.txt
  </code></pre>
  
  <p>After parsing, the <code>foo.path</code> option should be an absolute path to <code>/usr/local/config/assets/toto.txt</code>.</p>
  
  <p>Now if I specify <code>foo.path</code> in a configuration file, located at <code>/usr/local/config/myconf.cfg</code> like so:</p>
  
  <pre><code>foo.path=assets/toto.txt
  </code></pre>
  
  <p>I'd like the path to be relative to the configuration file (not the execution path) and that the resulting absolute path be the same as before.</p>
  
  <p>Is there a way in Boost Program Options for knowing where the value of an option came from so I could adjust the path when transforming relative paths to absolute ones ?</p>