Commit a2144287 authored by Wolfgang Bauer's avatar Wolfgang Bauer

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
parent fb8dbf51
......@@ -756,7 +756,14 @@ void MainWindow::saveNewToolbarConfig()
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment