- added another special variable (application path) that can be used for variable substituion in ini file values
This commit is contained in:
parent
3758a4ba92
commit
ae97a1306c
|
@ -210,6 +210,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
wxSize(Renderer::windowW, Renderer::windowH)), model(NULL), glCanvas(NULL), renderer(NULL), initTextureManager(true), timer(NULL)
|
wxSize(Renderer::windowW, Renderer::windowH)), model(NULL), glCanvas(NULL), renderer(NULL), initTextureManager(true), timer(NULL)
|
||||||
{
|
{
|
||||||
this->appPath = appPath;
|
this->appPath = appPath;
|
||||||
|
Properties::setApplicationPath(extractDirectoryPathFromFile(appPath));
|
||||||
|
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
//getGlPlatformExtensions();
|
//getGlPlatformExtensions();
|
||||||
|
|
|
@ -1508,6 +1508,8 @@ int glestMain(int argc, char** argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Properties::setApplicationPath(extractDirectoryPathFromFile(argv[0]));
|
||||||
|
|
||||||
ServerSocket::setMaxPlayerCount(GameConstants::maxPlayers);
|
ServerSocket::setMaxPlayerCount(GameConstants::maxPlayers);
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED = false;
|
SystemFlags::VERBOSE_MODE_ENABLED = false;
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VERBOSE_MODE]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VERBOSE_MODE]) == true) {
|
||||||
|
|
|
@ -43,9 +43,13 @@ private:
|
||||||
PropertyVector propertyVector;
|
PropertyVector propertyVector;
|
||||||
PropertyMap propertyMap;
|
PropertyMap propertyMap;
|
||||||
string path;
|
string path;
|
||||||
|
static string applicationPath;
|
||||||
|
|
||||||
bool applyTagsToValue(string &value);
|
bool applyTagsToValue(string &value);
|
||||||
public:
|
public:
|
||||||
|
static void setApplicationPath(string value) { applicationPath=value; }
|
||||||
|
static string getApplicationPath() { return applicationPath; }
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void load(const string &path);
|
void load(const string &path);
|
||||||
void save(const string &path);
|
void save(const string &path);
|
||||||
|
|
|
@ -25,6 +25,8 @@ using namespace Shared::PlatformCommon;
|
||||||
|
|
||||||
namespace Shared{ namespace Util{
|
namespace Shared{ namespace Util{
|
||||||
|
|
||||||
|
string Properties::applicationPath = "";
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class Properties
|
// class Properties
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -101,6 +103,9 @@ bool Properties::applyTagsToValue(string &value) {
|
||||||
replaceAll(value, "$USERNAME", (username != NULL ? username : ""));
|
replaceAll(value, "$USERNAME", (username != NULL ? username : ""));
|
||||||
replaceAll(value, "%%USERNAME%%", (username != NULL ? username : ""));
|
replaceAll(value, "%%USERNAME%%", (username != NULL ? username : ""));
|
||||||
|
|
||||||
|
replaceAll(value, "$APPLICATIONPATH", Properties::applicationPath);
|
||||||
|
replaceAll(value, "%%APPLICATIONPATH%%", Properties::applicationPath);
|
||||||
|
|
||||||
return (originalValue != value);
|
return (originalValue != value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user