Accepting request 336235 from home:wolfi323:branches:KDE:Applications

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)

OBS-URL: https://build.opensuse.org/request/show/336235
OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/kpat?expand=0&rev=18
This commit is contained in:
Raymond Wooninck 2015-10-04 13:24:06 +00:00 committed by Git OBS Bridge
parent fa9dd59b47
commit 3c96a8cd4d
3 changed files with 49 additions and 0 deletions

39
create_state_dir.patch Normal file
View File

@ -0,0 +1,39 @@
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.

View File

@ -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

View File

@ -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