diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-05-27 11:14:26 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-27 11:14:26 -0700 |
commit | a8c013869b0fd47c577dbaad95970db63fe604ad (patch) | |
tree | f1fad464f6aec91d45ba1259c275164a84808d00 /qt-ui/mainwindow.cpp | |
parent | 17b7bdfd2e7973c590d66819a8573a4ce8815e14 (diff) | |
download | subsurface-a8c013869b0fd47c577dbaad95970db63fe604ad.tar.gz |
Strip the default suffix if saving to git branch
For some reason the file selection dialog box now always adds a default
suffix to the file name we pick - which results in our test for git
storage to fail.
So if the filename looks like "<path>[branch].ssrf" then remove the suffix
that was added.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 00a6be60f..e94bce136 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -1277,6 +1277,7 @@ int MainWindow::file_save_as(void) tr("Subsurface XML files (*.ssrf *.xml *.XML)")); selection_dialog.setAcceptMode(QFileDialog::AcceptSave); selection_dialog.setFileMode(QFileDialog::AnyFile); + selection_dialog.setDefaultSuffix(""); /* if the exit/cancel button is pressed return */ if (!selection_dialog.exec()) @@ -1284,6 +1285,13 @@ int MainWindow::file_save_as(void) /* get the first selected file */ filename = selection_dialog.selectedFiles().at(0); + + /* now for reasons I don't understand we appear to add a .ssrf to + * git style filenames <path>/directory[branch] + * so let's remove that */ + QRegExp r("\\[.*\\]\\.ssrf$", Qt::CaseInsensitive); + if (filename.contains(r)) + filename.remove(QRegExp("\\.ssrf$", Qt::CaseInsensitive)); if (filename.isNull() || filename.isEmpty()) return report_error("No filename to save into"); |