[PATCH 05/12] Fix file extension regesp

Miika Turkia miika.turkia at gmail.com
Sun Apr 24 11:11:18 PDT 2016


The original negative lookahead failed in case the file name contains
more than 1 dot as it looks for dot that is not followed by the given
extensions. And such a match exists in the file name. The new version
should look properly if the file ends with any of the given extensions.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 desktop-widgets/mainwindow.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 0859ecb..c6624df 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1814,7 +1814,7 @@ void MainWindow::on_actionImportDiveLog_triggered()
 		return;
 	updateLastUsedDir(QFileInfo(fileNames[0]).dir().path());
 
-	QStringList logFiles = fileNames.filter(QRegExp("^.*\\.(?!(csv|txt|apd|zxu|zxl))", Qt::CaseInsensitive));
+	QStringList logFiles = fileNames.filter(QRegExp("^(?!.*\\.(csv|txt|apd|zxu|zxl))", Qt::CaseInsensitive));
 	QStringList csvFiles = fileNames.filter(".csv", Qt::CaseInsensitive);
 	csvFiles += fileNames.filter(".apd", Qt::CaseInsensitive);
 	csvFiles += fileNames.filter(".zxu", Qt::CaseInsensitive);
-- 
2.5.0



More information about the subsurface mailing list