Commit ac6a06ce authored by Jan Möbius's avatar Jan Möbius
Browse files

Dennis: Datadir access for plugins

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6574 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a2ef4306
...@@ -253,6 +253,13 @@ void Core::setupOptions() { ...@@ -253,6 +253,13 @@ void Core::setupOptions() {
tempDir.cd("Help"); tempDir.cd("Help");
OpenFlipper::Options::helpDir(tempDir.absolutePath()); OpenFlipper::Options::helpDir(tempDir.absolutePath());
// Set the Path to the main data directory
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
OpenFlipper::Options::dataDir(tempDir.absolutePath());
QStringList optionFiles; QStringList optionFiles;
// ============================================================== // ==============================================================
......
...@@ -79,6 +79,9 @@ static QDir fontsDir_; ...@@ -79,6 +79,9 @@ static QDir fontsDir_;
/// Stores the Path to the Help /// Stores the Path to the Help
static QDir helpDir_; static QDir helpDir_;
/// Stores the Path to the data directory
static QDir dataDir_;
/// Stores all available option files in the Order in which they should be used /// Stores all available option files in the Order in which they should be used
static QStringList optionFiles_; static QStringList optionFiles_;
...@@ -285,6 +288,7 @@ QDir scriptDir() { return scriptDir_; } ...@@ -285,6 +288,7 @@ QDir scriptDir() { return scriptDir_; }
QDir iconDir() { return iconDir_; } QDir iconDir() { return iconDir_; }
QDir fontsDir() { return fontsDir_; } QDir fontsDir() { return fontsDir_; }
QDir helpDir() { return helpDir_; } QDir helpDir() { return helpDir_; }
QDir dataDir() { return dataDir_; }
QDir currentDir() { return currentDir_; } QDir currentDir() { return currentDir_; }
QDir currentScriptDir() { return currentScriptDir_; } QDir currentScriptDir() { return currentScriptDir_; }
QDir currentTextureDir(){ return currentTextureDir_; } QDir currentTextureDir(){ return currentTextureDir_; }
...@@ -298,6 +302,7 @@ QString scriptDirStr() { return scriptDir_.absolutePath(); } ...@@ -298,6 +302,7 @@ QString scriptDirStr() { return scriptDir_.absolutePath(); }
QString iconDirStr() { return iconDir_.absolutePath(); } QString iconDirStr() { return iconDir_.absolutePath(); }
QString fontsDirStr() { return fontsDir_.absolutePath(); } QString fontsDirStr() { return fontsDir_.absolutePath(); }
QString helpDirStr() { return helpDir_.absolutePath(); } QString helpDirStr() { return helpDir_.absolutePath(); }
QString dataDirStr() { return dataDir_.absolutePath(); }
QString currentDirStr() { return currentDir_.absolutePath(); } QString currentDirStr() { return currentDir_.absolutePath(); }
QString currentScriptDirStr() { return currentScriptDir_.absolutePath(); } QString currentScriptDirStr() { return currentScriptDir_.absolutePath(); }
QString currentTextureDirStr() { return currentTextureDir_.absolutePath(); } QString currentTextureDirStr() { return currentTextureDir_.absolutePath(); }
...@@ -312,6 +317,7 @@ void scriptDir(QDir _dir) { scriptDir_ = _dir; } ...@@ -312,6 +317,7 @@ void scriptDir(QDir _dir) { scriptDir_ = _dir; }
void iconDir(QDir _dir) { iconDir_ = _dir; } void iconDir(QDir _dir) { iconDir_ = _dir; }
void fontsDir(QDir _dir) { fontsDir_ = _dir;} void fontsDir(QDir _dir) { fontsDir_ = _dir;}
void helpDir(QDir _dir) { helpDir_ = _dir;} void helpDir(QDir _dir) { helpDir_ = _dir;}
void dataDir(QDir _dir) { dataDir_ = _dir;}
void configDir(QDir _dir) { configDir_ = _dir; } void configDir(QDir _dir) { configDir_ = _dir; }
void currentDir(QDir _dir) { currentDir_ = _dir; } void currentDir(QDir _dir) { currentDir_ = _dir; }
void currentScriptDir(QDir _dir) { currentScriptDir_ = _dir; } void currentScriptDir(QDir _dir) { currentScriptDir_ = _dir; }
...@@ -373,6 +379,15 @@ bool iconDir(QString _dir) { ...@@ -373,6 +379,15 @@ bool iconDir(QString _dir) {
return false; return false;
} }
bool dataDir(QString _dir) {
QDir tmp(_dir);
if (tmp.exists()) {
dataDir_ = tmp;
return true;
}
return false;
}
QIcon& OpenFlipperIcon() { QIcon& OpenFlipperIcon() {
if (OpenFlipperIcon_ == 0){ if (OpenFlipperIcon_ == 0){
......
...@@ -84,6 +84,10 @@ QDir iconDir(); ...@@ -84,6 +84,10 @@ QDir iconDir();
DLLEXPORT DLLEXPORT
QDir fontsDir(); QDir fontsDir();
/// Returns the Path to the main data directory
DLLEXPORT
QDir dataDir();
/// Returns the base Path of the application /// Returns the base Path of the application
DLLEXPORT DLLEXPORT
QString applicationDirStr(); QString applicationDirStr();
...@@ -108,6 +112,10 @@ QString scriptDirStr(); ...@@ -108,6 +112,10 @@ QString scriptDirStr();
DLLEXPORT DLLEXPORT
QString iconDirStr(); QString iconDirStr();
/// Returns the Path to the main data directory
DLLEXPORT
QString dataDirStr();
/// Returns the OpenFlipper Icon /// Returns the OpenFlipper Icon
DLLEXPORT DLLEXPORT
QIcon& OpenFlipperIcon(); QIcon& OpenFlipperIcon();
...@@ -152,6 +160,10 @@ void fontsDir(QDir _dir); ...@@ -152,6 +160,10 @@ void fontsDir(QDir _dir);
DLLEXPORT DLLEXPORT
void helpDir(QDir _dir); void helpDir(QDir _dir);
/// Sets the Path to the data directory
DLLEXPORT
void dataDir(QDir _dir);
/// Sets the base Path of the application /// Sets the base Path of the application
DLLEXPORT DLLEXPORT
bool applicationDir(QString _dir); bool applicationDir(QString _dir);
...@@ -184,6 +196,10 @@ void fontsDir(QDir _dir); ...@@ -184,6 +196,10 @@ void fontsDir(QDir _dir);
DLLEXPORT DLLEXPORT
void helpDir(QDir _dir); void helpDir(QDir _dir);
/// Sets the Path to the data direcotry
DLLEXPORT
bool dataDir(QString _dir);
//=========================================================================== //===========================================================================
/** @name Option files / paths /** @name Option files / paths
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment