From e24a01d1fec9a27d12deba2c760c1ff8281e26d6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 21 Sep 2016 09:30:47 -0700 Subject: [PATCH] Add path parameter to goToSandbox --- libraries/networking/src/AddressManager.h | 2 +- libraries/shared/src/PathUtils.cpp | 14 ++++++++++++++ libraries/shared/src/PathUtils.h | 1 + libraries/shared/src/ServerPathUtils.cpp | 12 +++--------- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 248a1ef435..0ab70854eb 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -92,7 +92,7 @@ public slots: void goBack(); 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 goToUser(const QString& username); diff --git a/libraries/shared/src/PathUtils.cpp b/libraries/shared/src/PathUtils.cpp index 954ed2d75a..016b9ccfd6 100644 --- a/libraries/shared/src/PathUtils.cpp +++ b/libraries/shared/src/PathUtils.cpp @@ -17,6 +17,7 @@ #include #include #include "PathUtils.h" +#include const QString& PathUtils::resourcesPath() { @@ -29,6 +30,19 @@ const QString& PathUtils::resourcesPath() { 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 possibleExtensions) { QString fileNameLowered = fileName.toLower(); diff --git a/libraries/shared/src/PathUtils.h b/libraries/shared/src/PathUtils.h index 9f990815ce..43464fe236 100644 --- a/libraries/shared/src/PathUtils.h +++ b/libraries/shared/src/PathUtils.h @@ -22,6 +22,7 @@ class PathUtils : public QObject, public Dependency { Q_PROPERTY(QString resources READ resourcesPath) public: static const QString& resourcesPath(); + static QString getRootDataDirectory(); }; QString fileNameWithoutExtension(const QString& fileName, const QVector possibleExtensions); diff --git a/libraries/shared/src/ServerPathUtils.cpp b/libraries/shared/src/ServerPathUtils.cpp index ca87a28610..cf52875c5f 100644 --- a/libraries/shared/src/ServerPathUtils.cpp +++ b/libraries/shared/src/ServerPathUtils.cpp @@ -15,16 +15,10 @@ #include #include -QString ServerPathUtils::getDataDirectory() { - auto dataPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); +#include "PathUtils.h" -#ifdef Q_OS_WIN - dataPath += "/AppData/Roaming/"; -#elif defined(Q_OS_OSX) - dataPath += "/Library/Application Support/"; -#else - dataPath += "/.local/share/"; -#endif +QString ServerPathUtils::getDataDirectory() { + auto dataPath = PathUtils::getRootDataDirectory(); dataPath += qApp->organizationName() + "/" + qApp->applicationName();