- added support for specifying data and log paths in the standard glest.ini and glestuser.ini

DataPath=x
LogPath=x
This commit is contained in:
Mark Vejvoda 2011-05-02 18:28:57 +00:00
parent d4fb120b88
commit 402ae16657
1 changed files with 16 additions and 2 deletions

View File

@ -1038,7 +1038,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n\n");
}
int setupGameItemPaths(int argc, char** argv) {
int setupGameItemPaths(int argc, char** argv, Config *config) {
// Setup path cache for files and folders used in the game
std::map<string,string> &pathCache = CacheManager::getCachedItem< std::map<string,string> >(GameConstants::pathCacheLookupKey);
@ -1064,6 +1064,12 @@ int setupGameItemPaths(int argc, char** argv) {
return -1;
}
}
else if(config != NULL) {
if(config->getString("DataPath","") != "") {
pathCache[GameConstants::path_data_CacheLookupKey] = config->getString("DataPath","");
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using ini specified data path [%s]\n",config->getString("DataPath","").c_str());
}
}
//GAME_ARG_INI_PATH
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_INI_PATH]) == true) {
@ -1110,6 +1116,13 @@ int setupGameItemPaths(int argc, char** argv) {
return -1;
}
}
else if(config != NULL) {
if(config->getString("LogPath","") != "") {
pathCache[GameConstants::path_logs_CacheLookupKey] = config->getString("LogPath","");
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using ini specified logs path [%s]\n",config->getString("LogPath","").c_str());
}
}
return 0;
}
@ -2083,13 +2096,14 @@ int glestMain(int argc, char** argv) {
try {
// Setup paths to game items (like data, logs, ini etc)
int setupResult = setupGameItemPaths(argc, argv);
int setupResult = setupGameItemPaths(argc, argv, NULL);
if(setupResult != 0) {
return setupResult;
}
// Attempt to read ini files
Config &config = Config::getInstance();
setupGameItemPaths(argc, argv, &config);
string userData = config.getString("UserData_Root","");
if(userData != "") {