mirror-chatterino2/src/singletons/PathManager.hpp

49 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
#include <QString>
2018-06-21 13:02:34 +02:00
#include <boost/optional.hpp>
namespace chatterino {
class PathManager
{
2018-06-21 13:02:34 +02:00
PathManager();
2018-06-13 13:27:10 +02:00
public:
2018-06-21 13:02:34 +02:00
static void initInstance();
2018-06-13 13:27:10 +02:00
static PathManager *getInstance();
2018-06-21 13:02:34 +02:00
// Root directory for the configuration files. %APPDATA%/chatterino or ExecutablePath for
// portable mode
QString rootAppDataDirectory;
2018-06-21 13:02:34 +02:00
// Directory for settings files. Same as <appDataDirectory>/Settings
QString settingsDirectory;
2018-06-21 13:02:34 +02:00
// Directory for cache files. Same as <appDataDirectory>/Misc
QString cacheDirectory;
2018-06-21 13:02:34 +02:00
// Directory for message log files. Same as <appDataDirectory>/Misc
QString messageLogDirectory;
2018-06-21 13:02:34 +02:00
// Directory for miscellaneous files. Same as <appDataDirectory>/Misc
QString miscDirectory;
// Hash of QCoreApplication::applicationFilePath()
QString applicationFilePathHash;
2018-04-20 00:15:57 +02:00
bool createFolder(const QString &folderPath);
2018-05-28 18:25:19 +02:00
bool isPortable();
private:
2018-06-13 13:27:10 +02:00
static PathManager *instance;
2018-06-21 13:02:34 +02:00
boost::optional<bool> portable;
void initAppFilePathHash();
void initCheckPortable();
void initAppDataDirectory();
void initSubDirectories();
};
} // namespace chatterino