Merge pull request #23 from druiz17/serverless-domains

use resource path
This commit is contained in:
Seth Alves 2018-02-23 12:04:40 -08:00 committed by GitHub
commit d7b4eda5cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,19 +116,6 @@ const QString& PathUtils::resourcesUrl() {
return staticResourcePath; return staticResourcePath;
} }
QString applicationAbsolutePath() {
QString path;
#if defined(Q_OS_OSX)
path = QCoreApplication::applicationDirPath() + "/../";
#elif defined(Q_OS_ANDROID)
path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
#else
path = QCoreApplication::applicationDirPath() + "/";
#endif
return path;
}
QUrl PathUtils::resourcesUrl(const QString& relativeUrl) { QUrl PathUtils::resourcesUrl(const QString& relativeUrl) {
return QUrl(resourcesUrl() + relativeUrl); return QUrl(resourcesUrl() + relativeUrl);
} }
@ -137,14 +124,8 @@ QUrl PathUtils::expandToAppAbsolutePath(const QUrl& fileUrl) {
QUrl url = fileUrl; QUrl url = fileUrl;
QString path = fileUrl.path(); QString path = fileUrl.path();
if (path.startsWith("/~/")) { if (path.startsWith("/~/")) {
QString absolutePath = applicationAbsolutePath(); path.replace(0, 3, resourcesUrl());
path.replace(0, 3, absolutePath); url = QUrl(path);
#if defined(Q_OS_OSX)
url = QUrl("file://" + path);
#else
url = QUrl("file:///" + path);
#endif
qDebug() << "QQQQ expandToAppAbsolutePath " << fileUrl << url;
} }
return url; return url;
} }