config: add Config::_loadFile function to allow loading custom configuration file

This commit is contained in:
punkrockguy318 2012-03-06 06:03:26 +00:00
parent 13caaab8da
commit 878c379242
2 changed files with 19 additions and 1 deletions

View File

@ -578,13 +578,30 @@ char* Config::getConfigDirectory()
int
Config::_load()
{
std::string configFile = _dir + "/" + cfgFile;
bool success = Config::_loadFile(configFile.c_str());
return success;
}
int
Config::_loadFile(const char* fname)
{
signed int pos, eqPos;
std::fstream config;
std::map<std::string, int>::iterator int_i;
std::map<std::string, double>::iterator dbl_i;
std::map<std::string, std::string>::iterator str_i;
std::string configFile = _dir + "/" + cfgFile;
std::string configFile;
// if no filename argument was passed, parse the default configuration file
if(fname == NULL)
{
configFile = _dir + "/" + cfgFile;
} else
{
configFile = fname;
}
std::string line, name, value;
char buf[1024];

View File

@ -20,6 +20,7 @@ private:
int _addOption(char, const std::string &, const std::string &, int);
int _addOption(const std::string &, const std::string &, int);
int _load(void);
int _loadFile(const char* fname);
int _parseArgs(int, char **);
public: