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 {
|
|
|
|
|
2018-06-28 19:51:07 +02:00
|
|
|
class Paths
|
2018-01-05 02:23:49 +01:00
|
|
|
{
|
2018-06-28 19:51:07 +02:00
|
|
|
Paths();
|
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-28 19:51:07 +02:00
|
|
|
static Paths *getInstance();
|
2018-06-13 13:27:10 +02:00
|
|
|
|
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-21 13:02:34 +02:00
|
|
|
void initAppFilePathHash();
|
|
|
|
void initCheckPortable();
|
|
|
|
void initAppDataDirectory();
|
|
|
|
void initSubDirectories();
|
2018-07-06 19:23:47 +02:00
|
|
|
|
|
|
|
static Paths *instance;
|
|
|
|
boost::optional<bool> portable_;
|
2018-01-05 02:23:49 +01:00
|
|
|
};
|
|
|
|
|
2018-07-07 11:41:01 +02:00
|
|
|
Paths *getPaths();
|
|
|
|
|
2018-01-05 02:23:49 +01:00
|
|
|
} // namespace chatterino
|