Ignore:
Timestamp:
Mar 9, 2011, 8:35:04 AM (10 years ago)
Author:
tbretz
Message:
Added compatibility with boost V1.40
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Configuration.cc

    r10220 r10230  
    264264#include "Configuration.h"
    265265
     266#include <fstream>
    266267#include <iostream>
    267268
    268269#include <boost/regex.hpp>
    269 #include <boost/filesystem.hpp>
     270//#include <boost/filesystem.hpp>
    270271#include <boost/program_options.hpp>
    271272
     
    759760//!    - describe what happens in a more general way
    760761//!    - print a waring when no default coonfig file is read
     762//!    - proper handling and error messages if files not available
    761763//
    762764const po::variables_map &Configuration::Parse(int argc, char **argv)
     
    829831    const bool checkf    = !getfiles.count("dont-check-files") && !getfiles.count("dont-check");
    830832    const bool defaulted = getfiles.count("default") && getfiles["default"].defaulted();
    831     const bool exists    = boost::filesystem::exists(fDefaultFile);
    832 
     833    //const bool exists    = boost::filesystem::exists(fDefaultFile);
     834
     835    ifstream indef(fDefaultFile.c_str());
     836    // ===> FIXME: Proper handling of missing file or wrong file name
    833837    const po::parsed_options parsed_defaultfile =
    834         !exists && defaulted ?
     838        !indef && defaulted ?
    835839        po::parsed_options(&opt_configfile) :
    836         po::parse_config_file<char>(fDefaultFile.c_str(), opt_configfile, !checkf);
     840        po::parse_config_file<char>(indef, opt_configfile, !checkf);
    837841
    838842    // ------------------------ (6) --------------------------
     
    840844    if (getfiles.count("print-default") || getfiles.count("print-all"))
    841845    {
    842         if (!exists && defaulted)
     846        if (!indef && defaulted)
    843847            cout << "No configuration file by --default option specified." << endl;
    844848        else
     
    861865    }
    862866
    863     //        cout << "PRIO : " << fPriorityFile << endl;
    864 
     867    ifstream inpri(fPriorityFile.c_str());
     868    // ===> FIXME: Proper handling of missing file or wrong file name
    865869    const po::parsed_options parsed_priorityfile =
    866870        fPriorityFile.empty() ? po::parsed_options(&opt_configfile) :
    867         po::parse_config_file<char>(fPriorityFile.c_str(), opt_configfile, !checkf);
     871        po::parse_config_file<char>(inpri, opt_configfile, !checkf);
    868872
    869873    // ------------------------ (8) --------------------------
     
    888892    po::store(parsed_defaultfile,  getdatabase);
    889893
    890     //        cout << "NODB : " << getdatabase.count("no-database") << endl;
    891 
    892894    if (getdatabase.count("database") && !getdatabase.count("no-database"))
    893895    {
     
    896898    }
    897899
    898     //        cout << "DB   : " << fDatabase << endl;
    899900    const bool checkdb = !getdatabase.count("dont-check-database") && !getdatabase.count("dont-check");
    900901
Note: See TracChangeset for help on using the changeset viewer.