Pol  Revision:4b29d2b
multicfg.cpp
Go to the documentation of this file.
1 
8 #include <string>
9 
10 #include "../../clib/cfgfile.h"
11 #include "../../clib/fileutil.h"
12 #include "../../clib/refptr.h"
13 #include "../../plib/pkg.h"
14 #include "../../plib/systemstate.h"
15 #include "../cfgrepos.h"
16 
17 namespace Pol
18 {
19 namespace Multi
20 {
21 void load_special_storedconfig( const std::string& cfgname )
22 {
23  std::string main_cfg = "config/" + cfgname + ".cfg";
24 
27  if ( Clib::FileExists( main_cfg.c_str() ) )
28  {
29  Clib::ConfigFile cf_main( main_cfg.c_str() );
30  scfg->load( cf_main );
31  }
32 
33  for ( Plib::Packages::iterator itr = Plib::systemstate.packages.begin();
34  itr != Plib::systemstate.packages.end(); ++itr )
35  {
36  Plib::Package* pkg = ( *itr );
37  // string filename = pkg->dir() + cfgname + ".cfg";
38  std::string filename = Plib::GetPackageCfgPath( pkg, cfgname + ".cfg" );
39  if ( Clib::FileExists( filename.c_str() ) )
40  {
41  Clib::ConfigFile cf( filename.c_str() );
42  scfg->load( cf );
43  }
44  }
45 }
46 }
47 }
SystemState systemstate
Definition: systemstate.cpp:12
void CreateEmptyStoredConfigFile(const std::string &filename)
Definition: cfgrepos.cpp:338
Definition: refptr.h:65
void load_special_storedconfig(const std::string &cfgname)
Definition: multicfg.cpp:21
std::string GetPackageCfgPath(const Package *pkg, const std::string &filename)
Definition: pkg.cpp:491
bool FileExists(const char *filename)
Definition: fileutil.cpp:118
ConfigFileRef FindConfigFile(const std::string &filename, const std::string &allpkgbase)
Definition: cfgrepos.cpp:245
Definition: berror.cpp:12