Add path parameter to goToSandbox

This commit is contained in:
Ryan Huffman 2016-09-21 09:30:47 -07:00
parent 4c3cb83d47
commit e24a01d1fe
4 changed files with 19 additions and 10 deletions

View file

@ -92,7 +92,7 @@ public slots:
void goBack(); void goBack();
void goForward(); void goForward();
void goToLocalSandbox(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(SANDBOX_HIFI_ADDRESS, trigger); } void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); } void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); }
void goToUser(const QString& username); void goToUser(const QString& username);

View file

@ -17,6 +17,7 @@
#include <QDir> #include <QDir>
#include <QUrl> #include <QUrl>
#include "PathUtils.h" #include "PathUtils.h"
#include <QtCore/QStandardPaths>
const QString& PathUtils::resourcesPath() { const QString& PathUtils::resourcesPath() {
@ -29,6 +30,19 @@ const QString& PathUtils::resourcesPath() {
return staticResourcePath; return staticResourcePath;
} }
QString PathUtils::getRootDataDirectory() {
auto dataPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
#ifdef Q_OS_WIN
dataPath += "/AppData/Roaming/";
#elif defined(Q_OS_OSX)
dataPath += "/Library/Application Support/";
#else
dataPath += "/.local/share/";
#endif
return dataPath;
}
QString fileNameWithoutExtension(const QString& fileName, const QVector<QString> possibleExtensions) { QString fileNameWithoutExtension(const QString& fileName, const QVector<QString> possibleExtensions) {
QString fileNameLowered = fileName.toLower(); QString fileNameLowered = fileName.toLower();

View file

@ -22,6 +22,7 @@ class PathUtils : public QObject, public Dependency {
Q_PROPERTY(QString resources READ resourcesPath) Q_PROPERTY(QString resources READ resourcesPath)
public: public:
static const QString& resourcesPath(); static const QString& resourcesPath();
static QString getRootDataDirectory();
}; };
QString fileNameWithoutExtension(const QString& fileName, const QVector<QString> possibleExtensions); QString fileNameWithoutExtension(const QString& fileName, const QVector<QString> possibleExtensions);

View file

@ -15,16 +15,10 @@
#include <QtWidgets/qapplication.h> #include <QtWidgets/qapplication.h>
#include <QDebug> #include <QDebug>
QString ServerPathUtils::getDataDirectory() { #include "PathUtils.h"
auto dataPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
#ifdef Q_OS_WIN QString ServerPathUtils::getDataDirectory() {
dataPath += "/AppData/Roaming/"; auto dataPath = PathUtils::getRootDataDirectory();
#elif defined(Q_OS_OSX)
dataPath += "/Library/Application Support/";
#else
dataPath += "/.local/share/";
#endif
dataPath += qApp->organizationName() + "/" + qApp->applicationName(); dataPath += qApp->organizationName() + "/" + qApp->applicationName();