mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
29 lines
597 B
C++
29 lines
597 B
C++
#include "appdatapath.hpp"
|
|
|
|
#include <QDebug>
|
|
#include <QDir>
|
|
#include <QStandardPaths>
|
|
|
|
QString Path::appdataPath;
|
|
std::mutex Path::appdataPathMutex;
|
|
|
|
const QString &Path::getAppdataPath()
|
|
{
|
|
std::lock_guard<std::mutex> lock(appdataPathMutex);
|
|
|
|
if (appdataPath.isEmpty()) {
|
|
#ifdef PORTABLE
|
|
QString path = QCoreApplication::applicationDirPath();
|
|
#else
|
|
QString path =
|
|
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/Chatterino2/";
|
|
#endif
|
|
|
|
QDir(QDir::root()).mkdir(path);
|
|
|
|
appdataPath = path;
|
|
}
|
|
|
|
return appdataPath;
|
|
}
|