UserDataDir, AppDataDir, CacheDir added
This commit is contained in:
@@ -51,7 +51,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
|||||||
if(strcmp(argv[i], "--nowriteaccess") == 0) { noWriteAccess = 1; }
|
if(strcmp(argv[i], "--nowriteaccess") == 0) { noWriteAccess = 1; }
|
||||||
}
|
}
|
||||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||||
configRev = 30;
|
configRev = 32;
|
||||||
|
|
||||||
//standard defaults
|
//standard defaults
|
||||||
logOnOffDefault = "1";
|
logOnOffDefault = "1";
|
||||||
@@ -98,10 +98,14 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
|||||||
////define data-dir
|
////define data-dir
|
||||||
dataDir = configFileName;
|
dataDir = configFileName;
|
||||||
dataDir += "data\\";
|
dataDir += "data\\";
|
||||||
|
////define cache-dir
|
||||||
|
cacheDir = configFileName;
|
||||||
|
cacheDir += "cache\\";
|
||||||
//create directories on first start of app
|
//create directories on first start of app
|
||||||
mkdir(configFileName.c_str());
|
mkdir(configFileName.c_str());
|
||||||
mkdir(logDir.c_str());
|
mkdir(logDir.c_str());
|
||||||
mkdir(dataDir.c_str());
|
mkdir(dataDir.c_str());
|
||||||
|
mkdir(cacheDir.c_str());
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -116,11 +120,14 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
|||||||
////define data-dir
|
////define data-dir
|
||||||
dataDir = configFileName;
|
dataDir = configFileName;
|
||||||
dataDir += "data/";
|
dataDir += "data/";
|
||||||
|
////define cache-dir
|
||||||
|
cacheDir = configFileName;
|
||||||
|
cacheDir += "cache\\";
|
||||||
//create directories on first start of app
|
//create directories on first start of app
|
||||||
mkdir(configFileName.c_str(), MODUS) ;
|
mkdir(configFileName.c_str(), MODUS) ;
|
||||||
mkdir(logDir.c_str(), MODUS);
|
mkdir(logDir.c_str(), MODUS);
|
||||||
mkdir(dataDir.c_str(), MODUS);
|
mkdir(dataDir.c_str(), MODUS);
|
||||||
|
mkdir(cacheDir.c_str(), MODUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -199,7 +206,9 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
|||||||
configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir));
|
configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir));
|
||||||
configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2"));
|
configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2"));
|
||||||
configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0"));
|
configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("DataDir", CONFIG_TYPE_STRING, dataDir));
|
configList.push_back(ConfigInfo("UserDataDir", CONFIG_TYPE_STRING, dataDir));
|
||||||
|
configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString()));
|
||||||
|
configList.push_back(ConfigInfo("CacheDir", CONFIG_TYPE_STRING, cacheDir));
|
||||||
configList.push_back(ConfigInfo("CLA_NoWriteAccess", CONFIG_TYPE_INT, claNoWriteAccess));
|
configList.push_back(ConfigInfo("CLA_NoWriteAccess", CONFIG_TYPE_INT, claNoWriteAccess));
|
||||||
|
|
||||||
//fill tempList firstTime
|
//fill tempList firstTime
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ private:
|
|||||||
std::string configFileName;
|
std::string configFileName;
|
||||||
std::string logDir;
|
std::string logDir;
|
||||||
std::string dataDir;
|
std::string dataDir;
|
||||||
|
std::string cacheDir;
|
||||||
int configRev;
|
int configRev;
|
||||||
bool noWriteAccess;
|
bool noWriteAccess;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,13 @@
|
|||||||
|
|
||||||
#include "avatarmanager.h"
|
#include "avatarmanager.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem/operations.hpp> // includes path.hpp
|
||||||
|
#include <boost/filesystem/convenience.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ void joinNetworkGameDialogImpl::exec() {
|
|||||||
|
|
||||||
if (myConfig->readConfigInt("CLA_NoWriteAccess") == 0 ) {
|
if (myConfig->readConfigInt("CLA_NoWriteAccess") == 0 ) {
|
||||||
//if discwrite-access
|
//if discwrite-access
|
||||||
myServerProfilesFile = myConfig->readConfigString("DataDir")+"serverprofiles.xml";
|
myServerProfilesFile = myConfig->readConfigString("UserDataDir")+"serverprofiles.xml";
|
||||||
|
|
||||||
//Anlegen wenn noch nicht existiert!
|
//Anlegen wenn noch nicht existiert!
|
||||||
QFile serverProfilesfile(QString::fromUtf8(myServerProfilesFile.c_str()));
|
QFile serverProfilesfile(QString::fromUtf8(myServerProfilesFile.c_str()));
|
||||||
|
|||||||
@@ -57,3 +57,7 @@ QString QtHelper::getDataPath()
|
|||||||
return QDir::cleanPath(path) + "/";
|
return QDir::cleanPath(path) + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string QtHelper::getDataPathStdString()
|
||||||
|
{
|
||||||
|
return getDataPath().toUtf8().constData();
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
std::string getDefaultLanguage();
|
std::string getDefaultLanguage();
|
||||||
|
|
||||||
QString getDataPath();
|
QString getDataPath();
|
||||||
|
std::string getDataPathStdString();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,3 +38,5 @@ QtToolsWrapper::~QtToolsWrapper()
|
|||||||
|
|
||||||
std::string QtToolsWrapper::stringToUtf8(const std::string &myString) { return myQtHelper->stringToUtf8(myString); }
|
std::string QtToolsWrapper::stringToUtf8(const std::string &myString) { return myQtHelper->stringToUtf8(myString); }
|
||||||
std::string QtToolsWrapper::getDefaultLanguage() { return myQtHelper->getDefaultLanguage(); }
|
std::string QtToolsWrapper::getDefaultLanguage() { return myQtHelper->getDefaultLanguage(); }
|
||||||
|
std::string QtToolsWrapper::getDataPathStdString() { return myQtHelper->getDataPathStdString(); }
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
|
|
||||||
std::string stringToUtf8(const std::string &myString);
|
std::string stringToUtf8(const std::string &myString);
|
||||||
std::string getDefaultLanguage();
|
std::string getDefaultLanguage();
|
||||||
|
std::string getDataPathStdString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
//qthelper.cpp
|
//qthelper.cpp
|
||||||
virtual std::string stringToUtf8(const std::string &) =0;
|
virtual std::string stringToUtf8(const std::string &) =0;
|
||||||
virtual std::string getDefaultLanguage() =0;
|
virtual std::string getDefaultLanguage() =0;
|
||||||
|
virtual std::string getDataPathStdString() =0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user