summary refs log tree commit diff
path: root/src/main.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-12 20:36:16 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-12 20:36:16 +0300
commita97528b4322a3f114134722f8a4243b2938db6fd (patch)
tree0c4e2845702d9d67b8310b65e7af6b4855098493 /src/main.cc
parentAdd menu option to enable encryption in a private room (diff)
downloadnheko-a97528b4322a3f114134722f8a4243b2938db6fd.tar.xz
Fix bug where cache was initialized twice in a row
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc

index 13a712f4..0a127962 100644 --- a/src/main.cc +++ b/src/main.cc
@@ -17,6 +17,7 @@ #include <QApplication> #include <QDesktopWidget> +#include <QDir> #include <QFile> #include <QFontDatabase> #include <QLabel> @@ -48,6 +49,17 @@ screenCenter(int width, int height) return QPoint(x, y); } +void +createCacheDirectory() +{ + auto dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); + + if (!QDir().mkpath(dir)) { + throw std::runtime_error( + ("Unable to create state directory:" + dir).toStdString().c_str()); + } +} + int main(int argc, char *argv[]) { @@ -112,6 +124,8 @@ main(int argc, char *argv[]) http::init(); + createCacheDirectory(); + try { log::init(QString("%1/nheko.log") .arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))