From 4440911615c03dc66b531e86c6fbe2d3bcd0fe6c Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Tue, 22 Sep 2020 12:53:56 +0200 Subject: [PATCH] fix disappearing contacts #197 --- src/addressbook.cpp | 20 +++++--------------- src/mainwindow.cpp | 5 +++++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 93e2481..6e99e23 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -565,27 +565,17 @@ try { QString AddressBook::writeableFile() { - auto filename = QStringLiteral("addresslabels.dat"); - auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); + auto filename = QStringLiteral("addresslabels.dat"); - try { + auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); if (!dir.exists()) QDir().mkpath(dir.absolutePath()); - if (Settings::getInstance()->isTestnet()) + if (Settings::getInstance()->isTestnet()) { return dir.filePath("testnet-" % filename); - - else + } else { return dir.filePath(filename); - - } catch(...) { - QMessageBox msgWarning; - msgWarning.setText("WARNING!\nCould not write Addressbook."); - msgWarning.setIcon(QMessageBox::Warning); - msgWarning.setWindowTitle("Caution"); - msgWarning.exec(); - - } + } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d9f2402..b15b60c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -81,6 +81,11 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); + auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); + if (!dir.exists()){ + QDir().mkpath(dir.absolutePath()); + }else{} + logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log")); // Check for encryption