- 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:
parent
d4fb120b88
commit
402ae16657
|
@ -1038,7 +1038,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
||||||
printf("\n\n");
|
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
|
// Setup path cache for files and folders used in the game
|
||||||
std::map<string,string> &pathCache = CacheManager::getCachedItem< std::map<string,string> >(GameConstants::pathCacheLookupKey);
|
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;
|
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
|
//GAME_ARG_INI_PATH
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_INI_PATH]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_INI_PATH]) == true) {
|
||||||
|
@ -1110,6 +1116,13 @@ int setupGameItemPaths(int argc, char** argv) {
|
||||||
return -1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2083,13 +2096,14 @@ int glestMain(int argc, char** argv) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Setup paths to game items (like data, logs, ini etc)
|
// Setup paths to game items (like data, logs, ini etc)
|
||||||
int setupResult = setupGameItemPaths(argc, argv);
|
int setupResult = setupGameItemPaths(argc, argv, NULL);
|
||||||
if(setupResult != 0) {
|
if(setupResult != 0) {
|
||||||
return setupResult;
|
return setupResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to read ini files
|
// Attempt to read ini files
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
|
setupGameItemPaths(argc, argv, &config);
|
||||||
|
|
||||||
string userData = config.getString("UserData_Root","");
|
string userData = config.getString("UserData_Root","");
|
||||||
if(userData != "") {
|
if(userData != "") {
|
||||||
|
|
Loading…
Reference in New Issue