mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Issue #168 - Configuration cleanup
Removed 'data' part from token names, added token cleaning when invalid or unknown token is passed as commandline parameter. Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
This commit is contained in:
parent
c5dee2c4fb
commit
86f88bedae
1 changed files with 13 additions and 8 deletions
|
@ -12,10 +12,10 @@ static const char* const openmwCfgFile = "openmw.cfg";
|
|||
static const char* const ogreCfgFile = "ogre.cfg";
|
||||
static const char* const pluginsCfgFile = "plugins.cfg";
|
||||
|
||||
const char* const mwDataToken = "?mw:data?";
|
||||
const char* const localDataToken = "?local:data?";
|
||||
const char* const userDataToken = "?user:data?";
|
||||
const char* const globalDataToken = "?global:data?";
|
||||
const char* const mwToken = "?mw?";
|
||||
const char* const localToken = "?local?";
|
||||
const char* const userToken = "?user?";
|
||||
const char* const globalToken = "?global?";
|
||||
|
||||
ConfigurationManager::ConfigurationManager()
|
||||
: mFixedPath("openmw")
|
||||
|
@ -55,10 +55,10 @@ ConfigurationManager::~ConfigurationManager()
|
|||
|
||||
void ConfigurationManager::setupTokensMapping()
|
||||
{
|
||||
mTokensMapping.insert(std::make_pair(mwDataToken, &FixedPath<>::getInstallPath));
|
||||
mTokensMapping.insert(std::make_pair(localDataToken, &FixedPath<>::getLocalDataPath));
|
||||
mTokensMapping.insert(std::make_pair(userDataToken, &FixedPath<>::getUserDataPath));
|
||||
mTokensMapping.insert(std::make_pair(globalDataToken, &FixedPath<>::getGlobalDataPath));
|
||||
mTokensMapping.insert(std::make_pair(mwToken, &FixedPath<>::getInstallPath));
|
||||
mTokensMapping.insert(std::make_pair(localToken, &FixedPath<>::getLocalDataPath));
|
||||
mTokensMapping.insert(std::make_pair(userToken, &FixedPath<>::getUserDataPath));
|
||||
mTokensMapping.insert(std::make_pair(globalToken, &FixedPath<>::getGlobalDataPath));
|
||||
}
|
||||
|
||||
void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables,
|
||||
|
@ -105,6 +105,11 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs)
|
|||
(*it).clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clean invalid / unknown token, it will be removed outside the loop
|
||||
(*it).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue