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()
{
// This routine works with "/" as the standard:
// Figure out root: Up one from 'bin'
const QString homeDirPath = QDir::home().canonicalPath();
// Work out where the settings are stored on the machine
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;
storagePath += QLatin1Char('/');
storagePath += QLatin1String("OpenPilot");
storagePath += QLatin1Char('/');
// storagePath += QLatin1String("OpenPilot");
// storagePath += QLatin1Char('/');
return storagePath;
}
@ -118,7 +122,6 @@ QString PathUtils::RemoveStoragePath(QString path)
return QString("%%STOREPATH%%") + goodPath.right(i);
} else
return goodPath;
}
/**

View File

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