SHA256
1
0
forked from pool/kpat
Raymond Wooninck 2015-10-11 18:09:28 +00:00 committed by Git OBS Bridge
parent edcb21572a
commit 3614e15c49

View File

@ -1,39 +0,0 @@
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Sat, 03 Oct 2015 19:25:07 +0000
Subject: Create application directory if it doesn't exist
X-Git-Url: http://quickgit.kde.org/?p=kpat.git&a=commitdiff&h=a214428743993ac1ede3fa48d757ca339f498fd9
---
Create application directory if it doesn't exist
Unlike KStandardDirs, QStandardDirs doesn't guarantee that the returned
directory actually exists, see also
https://community.kde.org/Frameworks/Porting_Notes/KStandardDirs .
This patch checks for the existence of the directory and creates it if
it isn't there, before the game state is saved.
BUG: 350160
FIXED-IN: 15.08.2
REVIEW: 125508
---
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -756,7 +756,14 @@
void MainWindow::closeEvent(QCloseEvent *e)
{
- QString stateFileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + saved_state_file ;
+ QString stateDirName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+ QString stateFileName = stateDirName + QLatin1Char('/') + saved_state_file ;
+ QDir stateFileDir(stateDirName);
+ if(!stateFileDir.exists())
+ {
+ //create the directory if it doesn't exist (bug#350160)
+ stateFileDir.mkpath(QStringLiteral("."));
+ }
QFile stateFile( stateFileName );
// Remove the existing state file, if any.