From 387ac9b2f68644ad9e3cc45d80ce6181083119c9 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 14 Apr 2018 15:32:41 +0200 Subject: [PATCH] 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 --- src/singletons/pathmanager.cpp | 9 +++++++-- src/singletons/pathmanager.hpp | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/singletons/pathmanager.cpp b/src/singletons/pathmanager.cpp index a6356b208..9d6e73155 100644 --- a/src/singletons/pathmanager.cpp +++ b/src/singletons/pathmanager.cpp @@ -1,5 +1,6 @@ -#include "pathmanager.hpp" +#include "singletons/pathmanager.hpp" +#include #include #include @@ -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)); diff --git a/src/singletons/pathmanager.hpp b/src/singletons/pathmanager.hpp index f2d3e83ef..c4e6875d8 100644 --- a/src/singletons/pathmanager.hpp +++ b/src/singletons/pathmanager.hpp @@ -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