- bugfix for windows processing var tags in ini files (was crashing on windows when using the new glest-dev.ini)
This commit is contained in:
parent
cce3beb939
commit
7cae2b53f1
|
@ -1311,11 +1311,9 @@ int setupGameItemPaths(int argc, char** argv, Config *config) {
|
||||||
|
|
||||||
if(devProperties.hasString("ServerListPath") == true) {
|
if(devProperties.hasString("ServerListPath") == true) {
|
||||||
string devItem = devProperties.getString("ServerListPath");
|
string devItem = devProperties.getString("ServerListPath");
|
||||||
Properties::applyTagsToValue(devItem);
|
|
||||||
if(devItem != "") {
|
if(devItem != "") {
|
||||||
endPathWithSlash(devItem);
|
endPathWithSlash(devItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config != NULL) {
|
if(config != NULL) {
|
||||||
config->setString("ServerListPath",devItem,true);
|
config->setString("ServerListPath",devItem,true);
|
||||||
}
|
}
|
||||||
|
@ -1323,11 +1321,9 @@ int setupGameItemPaths(int argc, char** argv, Config *config) {
|
||||||
|
|
||||||
if(devProperties.hasString("GlestKeysIniPath") == true) {
|
if(devProperties.hasString("GlestKeysIniPath") == true) {
|
||||||
string devItem = devProperties.getString("GlestKeysIniPath");
|
string devItem = devProperties.getString("GlestKeysIniPath");
|
||||||
Properties::applyTagsToValue(devItem);
|
|
||||||
if(devItem != "") {
|
if(devItem != "") {
|
||||||
endPathWithSlash(devItem);
|
endPathWithSlash(devItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config != NULL) {
|
if(config != NULL) {
|
||||||
config->setString("GlestKeysIniPath",devItem,true);
|
config->setString("GlestKeysIniPath",devItem,true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,10 @@ ServerLine::ServerLine(MasterServerInfo *mServerInfo, int lineIndex, int baseY,
|
||||||
|
|
||||||
i+= 70;
|
i+= 70;
|
||||||
string platform=masterServerInfo.getPlatform();
|
string platform=masterServerInfo.getPlatform();
|
||||||
int revOffset=platform.find("-Rev");
|
size_t revOffset = platform.find("-Rev");
|
||||||
|
if(revOffset != platform.npos) {
|
||||||
platform = platform.substr(0,revOffset);
|
platform = platform.substr(0,revOffset);
|
||||||
|
}
|
||||||
|
|
||||||
platformLabel.init(i, baseY - lineOffset);
|
platformLabel.init(i, baseY - lineOffset);
|
||||||
platformLabel.setTextColor(color);
|
platformLabel.setTextColor(color);
|
||||||
|
|
|
@ -102,6 +102,8 @@ public:
|
||||||
|
|
||||||
static bool applyTagsToValue(string &value, const std::map<string,string> *mapTagReplacementValues=NULL);
|
static bool applyTagsToValue(string &value, const std::map<string,string> *mapTagReplacementValues=NULL);
|
||||||
static std::map<string,string> getTagReplacementValues(std::map<string,string> *mapExtraTagReplacementValues=NULL);
|
static std::map<string,string> getTagReplacementValues(std::map<string,string> *mapExtraTagReplacementValues=NULL);
|
||||||
|
static bool isValuePathVariable(const string &value);
|
||||||
|
static void Properties::updateValuePathVariable(string &value);
|
||||||
|
|
||||||
string getpath() const { return path;}
|
string getpath() const { return path;}
|
||||||
|
|
||||||
|
|
|
@ -261,9 +261,39 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
|
||||||
return mapTagReplacementValues;
|
return mapTagReplacementValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Properties::isValuePathVariable(const string &value) {
|
||||||
|
if(value.find("~/") != value.npos ||
|
||||||
|
value.find("$HOME") != value.npos ||
|
||||||
|
value.find("%%HOME%%") != value.npos ||
|
||||||
|
value.find("%%USERPROFILE%%") != value.npos ||
|
||||||
|
value.find("%%HOMEPATH%%") != value.npos ||
|
||||||
|
value.find("{HOMEPATH}") != value.npos ||
|
||||||
|
value.find("$APPDATA") != value.npos ||
|
||||||
|
value.find("%%APPDATA%%") != value.npos ||
|
||||||
|
value.find("{APPDATA}") != value.npos ||
|
||||||
|
value.find("$APPLICATIONPATH") != value.npos ||
|
||||||
|
value.find("%%APPLICATIONPATH%%") != value.npos ||
|
||||||
|
value.find("{APPLICATIONPATH}") != value.npos ||
|
||||||
|
value.find("$APPLICATIONDATAPATH") != value.npos ||
|
||||||
|
value.find("%%APPLICATIONDATAPATH%%") != value.npos ||
|
||||||
|
value.find("{APPLICATIONDATAPATH}") != value.npos ||
|
||||||
|
value.find("{TECHTREEPATH}") != value.npos ||
|
||||||
|
value.find("{SCENARIOPATH}") != value.npos ||
|
||||||
|
value.find("{TUTORIALPATH}") != value.npos) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void Properties::updateValuePathVariable(string &value) {
|
||||||
|
replaceAll(value,"//","/");
|
||||||
|
replaceAll(value,"\\\\","\\");
|
||||||
|
updatePathClimbingParts(value);
|
||||||
|
}
|
||||||
|
|
||||||
bool Properties::applyTagsToValue(string &value, const std::map<string,string> *mapTagReplacementValues) {
|
bool Properties::applyTagsToValue(string &value, const std::map<string,string> *mapTagReplacementValues) {
|
||||||
string originalValue = value;
|
string originalValue = value;
|
||||||
|
bool valueRequiresPathUpdate = Properties::isValuePathVariable(value);
|
||||||
//if(originalValue.find("$APPLICATIONDATAPATH") != string::npos) {
|
//if(originalValue.find("$APPLICATIONDATAPATH") != string::npos) {
|
||||||
// printf("\nBEFORE SUBSTITUTE [%s] app [%s] mapTagReplacementValues [%p]\n",originalValue.c_str(),Properties::applicationPath.c_str(),mapTagReplacementValues);
|
// printf("\nBEFORE SUBSTITUTE [%s] app [%s] mapTagReplacementValues [%p]\n",originalValue.c_str(),Properties::applicationPath.c_str(),mapTagReplacementValues);
|
||||||
//}
|
//}
|
||||||
|
@ -357,6 +387,10 @@ bool Properties::applyTagsToValue(string &value, const std::map<string,string> *
|
||||||
//if(originalValue != value || originalValue.find("$APPLICATIONDATAPATH") != string::npos) {
|
//if(originalValue != value || originalValue.find("$APPLICATIONDATAPATH") != string::npos) {
|
||||||
// printf("\nBEFORE SUBSTITUTE [%s] AFTER [%s]\n",originalValue.c_str(),value.c_str());
|
// printf("\nBEFORE SUBSTITUTE [%s] AFTER [%s]\n",originalValue.c_str(),value.c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
if(valueRequiresPathUpdate == true) {
|
||||||
|
Properties::updateValuePathVariable(value);
|
||||||
|
}
|
||||||
return (originalValue != value);
|
return (originalValue != value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user