- ported bugfixes to trunk from 3.6.0.3

This commit is contained in:
Mark Vejvoda
2012-01-24 21:28:05 +00:00
11 changed files with 55 additions and 26 deletions

View File

@@ -500,6 +500,13 @@ void endPathWithSlash(string &path,bool requireOSSlash) {
}
}
string formatPath(string path) {
replaceAll(path, "\"", "");
replaceAll(path, "//", "/");
return path;
}
void trimPathWithStartingSlash(string &path) {
if(StartsWith(path, "/") == true || StartsWith(path, "\\") == true) {
path.erase(path.begin(),path.begin()+1);

View File

@@ -15,6 +15,11 @@
#include "platform_common.h"
#include "libircclient.h"
// upstream moved some defines into new headers as of 1.6
#ifndef LIBIRCCLIENT_PRE1_6
#include "libirc_rfcnumeric.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include <string.h>

View File

@@ -79,11 +79,11 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
#ifndef WIN32
string mg_icon_file = "";
#if defined(CUSTOM_DATA_INSTALL_PATH_VALUE)
if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png")) {
mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png";
if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png")) {
mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png";
}
else if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp")) {
mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp";
else if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp")) {
mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp";
}
#endif

View File

@@ -215,20 +215,15 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
mapTagReplacementValues["{APPLICATIONPATH}"] = Properties::applicationPath;
#if defined(CUSTOM_DATA_INSTALL_PATH)
mapTagReplacementValues["$APPLICATIONDATAPATH"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
//mapTagReplacementValues["$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
//mapTagReplacementValues["%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
mapTagReplacementValues["$APPLICATIONDATAPATH"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
#else
mapTagReplacementValues["$APPLICATIONDATAPATH"] = Properties::applicationPath;
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = Properties::applicationPath;
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = Properties::applicationPath;
//mapTagReplacementValues["$COMMONDATAPATH", Properties::applicationPath + "/commondata/");
//mapTagReplacementValues["%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/");
#endif
mapTagReplacementValues["$GAMEVERSION"] = Properties::gameVersion;
@@ -308,20 +303,15 @@ bool Properties::applyTagsToValue(string &value, std::map<string,string> *mapTag
replaceAll(value, "{APPLICATIONPATH}", Properties::applicationPath);
#if defined(CUSTOM_DATA_INSTALL_PATH)
replaceAll(value, "$APPLICATIONDATAPATH", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
replaceAll(value, "%%APPLICATIONDATAPATH%%", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
replaceAll(value, "{APPLICATIONDATAPATH}", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
//replaceAll(value, "$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
//replaceAll(value, "%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
replaceAll(value, "$APPLICATIONDATAPATH", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
replaceAll(value, "%%APPLICATIONDATAPATH%%", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
replaceAll(value, "{APPLICATIONDATAPATH}", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
#else
replaceAll(value, "$APPLICATIONDATAPATH", Properties::applicationPath);
replaceAll(value, "%%APPLICATIONDATAPATH%%", Properties::applicationPath);
replaceAll(value, "{APPLICATIONDATAPATH}", Properties::applicationPath);
//replaceAll(value, "$COMMONDATAPATH", Properties::applicationPath + "/commondata/");
//replaceAll(value, "%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/");
#endif
replaceAll(value, "$GAMEVERSION", Properties::gameVersion);