From c1cdaa4a25fa143ac66235fe5d11fbe9504c7498 Mon Sep 17 00:00:00 2001 From: RobertKrajewski Date: Sun, 3 Jan 2016 22:17:53 +0100 Subject: [PATCH] Fixed different bugs in code for saving course data to file --- l2pitemmodel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/l2pitemmodel.cpp b/l2pitemmodel.cpp index 9521b7b..57d66d0 100644 --- a/l2pitemmodel.cpp +++ b/l2pitemmodel.cpp @@ -141,9 +141,17 @@ void L2pItemModel::saveDataToFile() #else QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); #endif - QFile file(dataPath + DATAFILENAME); + + if(!QDir(dataPath).exists()) + { + QDir().mkdir(dataPath); + } + + QFile file(dataPath + "/" + DATAFILENAME); if(!file.open(QIODevice::WriteOnly)) { + Utils::errorMessageBox(tr("Kursinformationen nicht speicherbar."), + file.errorString()); return; } QTextStream ts(&file);