diff --git a/create_state_dir.patch b/create_state_dir.patch new file mode 100644 index 0000000..a2d509e --- /dev/null +++ b/create_state_dir.patch @@ -0,0 +1,39 @@ +From: Wolfgang Bauer +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. + diff --git a/kpat.changes b/kpat.changes index 5b53500..31ae316 100644 --- a/kpat.changes +++ b/kpat.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Oct 3 19:39:24 UTC 2015 - wbauer@tmo.at + +- Add create_state_dir.patch: fixes saving of the game state on + exit when the application directory doesn't exist yet + (boo#948289, kde#350160) + ------------------------------------------------------------------- Sun Sep 13 19:22:26 UTC 2015 - tittiatcoke@gmail.com diff --git a/kpat.spec b/kpat.spec index 2be7e13..76dd3e4 100644 --- a/kpat.spec +++ b/kpat.spec @@ -24,6 +24,8 @@ Url: http://www.kde.org Version: 15.08.1 Release: 0 Source0: kpat-%{version}.tar.xz +# PATCH-FIX-UPSTREAM create_state_dir.patch boo#948289, kde#350160 -- fixes saving of the game state on exit when the application directory doesn't exist yet +Patch: create_state_dir.patch BuildRequires: libkdegames-devel BuildRequires: update-desktop-files BuildRequires: extra-cmake-modules @@ -64,6 +66,7 @@ more. The game has nice graphics and many different carddecks. %prep %setup -q +%patch -p1 %build %cmake_kf5 -d build