From 6ba3f353f49635c61b7610bacdaf9d9a088c0dbb Mon Sep 17 00:00:00 2001 From: Alexandre Quessy Date: Sat, 3 May 2014 12:03:26 -0400 Subject: [PATCH] FIX: Append file ext if not provided when save --- MainWindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index c515beb..b008cc0 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -232,15 +232,25 @@ bool MainWindow::saveAs() videoTimer->stop(); // Popul file dialog to choose filename. - QString fileName = QFileDialog::getSaveFileName(this, tr("Save project"), + QString fileName = QFileDialog::getSaveFileName(this, + tr("Save project"), ".", - tr("MapMap files (*.%1)", MAPMAP_EXTENSION)); + tr("MapMap files (*.%1)", MAPMAP_EXTENSION) + ); // Restart video playback. XXX Hack videoTimer->start(); if (fileName.isEmpty()) return false; + + if (! fileName.endsWith(MAPMAP_EXTENSION)) + { + std::cout << "filename doesn't end with expected extension: " << + fileName.toStdString() << std::endl; + fileName.append("."); + fileName.append(MAPMAP_EXTENSION); + } // Save to filename. return saveFile(fileName);