1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 18:06:43 +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:
Lukasz Gromanowski 2012-01-28 11:59:08 +01:00
parent c5dee2c4fb
commit 86f88bedae

View file

@ -12,10 +12,10 @@ static const char* const openmwCfgFile = "openmw.cfg";
static const char* const ogreCfgFile = "ogre.cfg"; static const char* const ogreCfgFile = "ogre.cfg";
static const char* const pluginsCfgFile = "plugins.cfg"; static const char* const pluginsCfgFile = "plugins.cfg";
const char* const mwDataToken = "?mw:data?"; const char* const mwToken = "?mw?";
const char* const localDataToken = "?local:data?"; const char* const localToken = "?local?";
const char* const userDataToken = "?user:data?"; const char* const userToken = "?user?";
const char* const globalDataToken = "?global:data?"; const char* const globalToken = "?global?";
ConfigurationManager::ConfigurationManager() ConfigurationManager::ConfigurationManager()
: mFixedPath("openmw") : mFixedPath("openmw")
@ -55,10 +55,10 @@ ConfigurationManager::~ConfigurationManager()
void ConfigurationManager::setupTokensMapping() void ConfigurationManager::setupTokensMapping()
{ {
mTokensMapping.insert(std::make_pair(mwDataToken, &FixedPath<>::getInstallPath)); mTokensMapping.insert(std::make_pair(mwToken, &FixedPath<>::getInstallPath));
mTokensMapping.insert(std::make_pair(localDataToken, &FixedPath<>::getLocalDataPath)); mTokensMapping.insert(std::make_pair(localToken, &FixedPath<>::getLocalDataPath));
mTokensMapping.insert(std::make_pair(userDataToken, &FixedPath<>::getUserDataPath)); mTokensMapping.insert(std::make_pair(userToken, &FixedPath<>::getUserDataPath));
mTokensMapping.insert(std::make_pair(globalDataToken, &FixedPath<>::getGlobalDataPath)); mTokensMapping.insert(std::make_pair(globalToken, &FixedPath<>::getGlobalDataPath));
} }
void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables, void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables,
@ -105,6 +105,11 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs)
(*it).clear(); (*it).clear();
} }
} }
else
{
// Clean invalid / unknown token, it will be removed outside the loop
(*it).clear();
}
} }
} }