1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

Modify "StoragePath" to use the settings storage directory and not the home directory. Works on Linux.

This commit is contained in:
elafargue 2011-05-09 15:19:10 +02:00
parent c36b6a715b
commit a97efad8f9
2 changed files with 9 additions and 5 deletions

View File

@ -96,12 +96,16 @@ QString PathUtils::InsertDataPath(QString path)
QString PathUtils::GetStoragePath() QString PathUtils::GetStoragePath()
{ {
// This routine works with "/" as the standard: // This routine works with "/" as the standard:
// Figure out root: Up one from 'bin' // Work out where the settings are stored on the machine
const QString homeDirPath = QDir::home().canonicalPath(); QSettings set(QSettings::IniFormat, QSettings::UserScope,QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS"));
QFileInfo f(set.fileName());
QDir dir(f.absoluteDir());
const QString homeDirPath = dir.canonicalPath();
QString storagePath = homeDirPath; QString storagePath = homeDirPath;
storagePath += QLatin1Char('/'); storagePath += QLatin1Char('/');
storagePath += QLatin1String("OpenPilot"); // storagePath += QLatin1String("OpenPilot");
storagePath += QLatin1Char('/'); // storagePath += QLatin1Char('/');
return storagePath; return storagePath;
} }
@ -118,7 +122,6 @@ QString PathUtils::RemoveStoragePath(QString path)
return QString("%%STOREPATH%%") + goodPath.right(i); return QString("%%STOREPATH%%") + goodPath.right(i);
} else } else
return goodPath; return goodPath;
} }
/** /**

View File

@ -33,6 +33,7 @@
#include "../extensionsystem/pluginmanager.h" #include "../extensionsystem/pluginmanager.h"
#include <QDir> #include <QDir>
#include <QApplication> #include <QApplication>
#include <QSettings>
namespace Utils { namespace Utils {