Changeset 10230 for trunk/FACT++/src/Configuration.cc
- Timestamp:
- 03/09/11 08:35:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Configuration.cc
r10220 r10230 264 264 #include "Configuration.h" 265 265 266 #include <fstream> 266 267 #include <iostream> 267 268 268 269 #include <boost/regex.hpp> 269 #include <boost/filesystem.hpp>270 //#include <boost/filesystem.hpp> 270 271 #include <boost/program_options.hpp> 271 272 … … 759 760 //! - describe what happens in a more general way 760 761 //! - print a waring when no default coonfig file is read 762 //! - proper handling and error messages if files not available 761 763 // 762 764 const po::variables_map &Configuration::Parse(int argc, char **argv) … … 829 831 const bool checkf = !getfiles.count("dont-check-files") && !getfiles.count("dont-check"); 830 832 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 833 837 const po::parsed_options parsed_defaultfile = 834 ! exists&& defaulted ?838 !indef && defaulted ? 835 839 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); 837 841 838 842 // ------------------------ (6) -------------------------- … … 840 844 if (getfiles.count("print-default") || getfiles.count("print-all")) 841 845 { 842 if (! exists&& defaulted)846 if (!indef && defaulted) 843 847 cout << "No configuration file by --default option specified." << endl; 844 848 else … … 861 865 } 862 866 863 // cout << "PRIO : " << fPriorityFile << endl;864 867 ifstream inpri(fPriorityFile.c_str()); 868 // ===> FIXME: Proper handling of missing file or wrong file name 865 869 const po::parsed_options parsed_priorityfile = 866 870 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); 868 872 869 873 // ------------------------ (8) -------------------------- … … 888 892 po::store(parsed_defaultfile, getdatabase); 889 893 890 // cout << "NODB : " << getdatabase.count("no-database") << endl;891 892 894 if (getdatabase.count("database") && !getdatabase.count("no-database")) 893 895 { … … 896 898 } 897 899 898 // cout << "DB : " << fDatabase << endl;899 900 const bool checkdb = !getdatabase.count("dont-check-database") && !getdatabase.count("dont-check"); 900 901
Note:
See TracChangeset
for help on using the changeset viewer.