Changeset 11039 for trunk/FACT++
- Timestamp:
- 06/16/11 19:41:33 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Configuration.cc
r11020 r11039 467 467 //! 468 468 // 469 Configuration::Configuration(const string &prgname) : fName( prgname),469 Configuration::Configuration(const string &prgname) : fName(UnLibToolize(prgname)), 470 470 fNameMapper(bind1st(mem_fun(&Configuration::DefaultMapper), this)), 471 471 fPrintUsage(boost::bind(&Configuration::PrintUsage, this)) … … 493 493 po::options_description def_config; 494 494 def_config.add_options() 495 ("default", var<string>( prgname+string(".rc")), "Default configuration file.")495 ("default", var<string>(fName+string(".rc")), "Default configuration file.") 496 496 ; 497 497 … … 1035 1035 // -------------------------------------------------------------------------- 1036 1036 // 1037 //! Removes /.libs/lt- from a path or just lt- from the filename. 1038 //! 1039 //! @param src 1040 //! input path with filename 1041 //! @returns 1042 //! path cleaned from libtool extensions 1043 //! 1044 string Configuration::UnLibToolize(const string &src) const 1045 { 1046 const boost::filesystem::path path(src); 1047 1048 string pname = path.parent_path().string(); 1049 string fname = path.filename(); 1050 1051 if (fname.substr(0, 3)=="lt-") 1052 fname = fname.substr(3); 1053 1054 if (pname==".libs") 1055 return fname; 1056 1057 const size_t pos = pname.length()-6; 1058 if (pname.substr(pos)=="/.libs") 1059 pname = pname.substr(0, pos); 1060 1061 return pname+'/'+fname; 1062 } 1063 1064 // -------------------------------------------------------------------------- 1065 // 1037 1066 //! Print version information about the program and package. 1038 1067 //! … … 1092 1121 } 1093 1122 1094 std::string n = boost::filesystem::basename(fName); 1095 if (n.substr(0, 3)=="lt-") 1096 n = n.substr(3); 1123 const std::string n = boost::filesystem::path(fName).filename(); 1097 1124 1098 1125 const string name = PACKAGE_STRING; -
trunk/FACT++/src/Configuration.h
r10796 r11039 63 63 virtual void PrintUsage() const { } 64 64 virtual void PrintVersion() const; 65 66 std::string UnLibToolize(const std::string &src) const; 65 67 66 68 public:
Note:
See TracChangeset
for help on using the changeset viewer.