Change portable folder to Qt's "Application dir path"

Enable portable mode if there's a "portable" file or folder in the
Application dir path

Fix #334
This commit is contained in:
Rasmus Karlsson 2018-04-14 15:32:41 +02:00
parent 597660af2f
commit 387ac9b2f6
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,6 @@
#include "pathmanager.hpp"
#include "singletons/pathmanager.hpp"
#include <QCoreApplication>
#include <QDir>
#include <QStandardPaths>
@ -23,10 +24,14 @@ bool PathManager::init(int argc, char **argv)
}
}
if (QFileInfo::exists(QCoreApplication::applicationDirPath() + "/portable")) {
portable = true;
}
// Root path = %APPDATA%/Chatterino or the folder that the executable resides in
QString rootPath;
if (portable) {
rootPath.append(QDir::currentPath());
rootPath.append(QCoreApplication::applicationDirPath());
} else {
// Get settings path
rootPath.append(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));

View file

@ -14,8 +14,13 @@ public:
bool init(int argc, char **argv);
// %APPDATA%/chatterino or ExecutablePath for portable mode
QString settingsFolderPath;
// %APPDATA%/chatterino/Custom or ExecutablePath/Custom for portable mode
QString customFolderPath;
// %APPDATA%/chatterino/Cache or ExecutablePath/Cache for portable mode
QString cacheFolderPath;
// Logs