1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Fixed local paths for Mac OS file system

This commit is contained in:
Dominik Louven 2018-11-26 20:38:10 +01:00
parent 9a97f19918
commit 3ab531877a
3 changed files with 8 additions and 8 deletions

View File

@ -90,11 +90,11 @@ void InstalledListModel::loadScreens()
QJsonDocument jsonProject;
QJsonParseError parseError;
QFileInfoList list = QDir(m_absoluteStoragePath.toString()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
QFileInfoList list = QDir(m_absoluteStoragePath.toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
QString tmpPath;
for (auto&& item : list) {
tmpPath = m_absoluteStoragePath.toString() + "/" + item.baseName() + "/project.json";
tmpPath = m_absoluteStoragePath.toLocalFile() + "/" + item.baseName() + "/project.json";
if (!QFile(tmpPath).exists())
continue;

View File

@ -1,6 +1,6 @@
#include "settings.h"
#include <QGuiApplication>
#include <QStandardPaths>
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent)
: QObject(parent)
{
@ -13,10 +13,10 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_qGuiApplication = app;
QFile configTmp;
QString appConfigLocation = QGuiApplication::applicationDirPath();
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
m_localSettingsPath = QUrl(appConfigLocation);
if (!QDir(appConfigLocation).exists()) {
if (!QDir().mkdir(appConfigLocation)) {
if (!QDir().mkpath(appConfigLocation)) {
qWarning("ERROR: Cloud not create install dir");
return;
}
@ -69,7 +69,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_localStoragePath = steamTmpUrl.path();
} else {
m_localStoragePath = configObj.value("absoluteStoragePath").toString();
m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString());
}
m_ilm->setabsoluteStoragePath(m_localStoragePath);
@ -264,7 +264,7 @@ void Settings::setPlayAll(bool isPlaying)
void Settings::createDefaultConfig()
{
QFile file(QGuiApplication::applicationDirPath() + "/settings.json");
QFile file(m_localSettingsPath.toString() + "/settings.json");
QFile defaultSettings(":/settings.json");
file.open(QIODevice::WriteOnly | QIODevice::Text);

View File

@ -227,7 +227,7 @@ public slots:
return;
//Remove: "file:///"
QJsonValue cleanedPath = QJsonValue(QString(localStoragePath.toString()).remove(0, 8));
QJsonValue cleanedPath = QJsonValue(localStoragePath.toString()); // QJsonValue(QString(localStoragePath.toString()).remove(0, 8));
writeSingleSettingConfig("absoluteStoragePath", cleanedPath);