2018-01-05 02:23:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
2018-06-21 13:02:34 +02:00
|
|
|
#include <boost/optional.hpp>
|
2018-01-05 02:23:49 +01:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class PathManager
|
|
|
|
{
|
2018-06-21 13:02:34 +02:00
|
|
|
PathManager();
|
2018-01-05 02:23:49 +01:00
|
|
|
|
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-04-14 15:32:41 +02:00
|
|
|
|
2018-06-21 13:02:34 +02:00
|
|
|
// Directory for settings files. Same as <appDataDirectory>/Settings
|
|
|
|
QString settingsDirectory;
|
2018-04-14 15:32:41 +02:00
|
|
|
|
2018-06-21 13:02:34 +02:00
|
|
|
// Directory for cache files. Same as <appDataDirectory>/Misc
|
|
|
|
QString cacheDirectory;
|
2018-01-28 14:23:55 +01:00
|
|
|
|
2018-06-21 13:02:34 +02:00
|
|
|
// Directory for message log files. Same as <appDataDirectory>/Misc
|
|
|
|
QString messageLogDirectory;
|
2018-01-28 14:23:55 +01:00
|
|
|
|
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
|
|
|
|
2018-01-28 14:23:55 +01: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();
|
2018-01-05 02:23:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|