From 01216696f0adef65f4e51b599ff22eb8b0778a0d Mon Sep 17 00:00:00 2001
From: Elliot Oram <elliot.oram@stfc.ac.uk>
Date: Mon, 1 Oct 2018 09:34:31 +0100
Subject: [PATCH] Allow for empty file extension

Refs #23388
---
 Framework/DataHandling/src/LoadAscii.cpp            | 2 +-
 Framework/DataHandling/src/LoadNXSPE.cpp            | 2 +-
 Framework/DataHandling/src/SaveDiffFittingAscii.cpp | 2 +-
 Framework/DataHandling/src/SaveOpenGenieAscii.cpp   | 2 +-
 qt/widgets/common/src/FileDialogHandler.cpp         | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp
index 75c33b7860f..3a3b20e6249 100644
--- a/Framework/DataHandling/src/LoadAscii.cpp
+++ b/Framework/DataHandling/src/LoadAscii.cpp
@@ -300,7 +300,7 @@ void LoadAscii::fillInputValues(std::vector<double> &values,
 //--------------------------------------------------------------------------
 /// Initialisation method.
 void LoadAscii::init() {
-  const std::vector<std::string> extensions{".dat", ".txt", ".csv"};
+  const std::vector<std::string> extensions{".dat", ".txt", ".csv", ""};
   declareProperty(Kernel::make_unique<FileProperty>(
                       "Filename", "", FileProperty::Load, extensions),
                   "The name of the text file to read, including its full or "
diff --git a/Framework/DataHandling/src/LoadNXSPE.cpp b/Framework/DataHandling/src/LoadNXSPE.cpp
index 20a68a82f2e..7ffa03c8b64 100644
--- a/Framework/DataHandling/src/LoadNXSPE.cpp
+++ b/Framework/DataHandling/src/LoadNXSPE.cpp
@@ -88,7 +88,7 @@ int LoadNXSPE::confidence(Kernel::NexusDescriptor &descriptor) const {
 /** Initialize the algorithm's properties.
  */
 void LoadNXSPE::init() {
-  const std::vector<std::string> exts{".nxspe"};
+  const std::vector<std::string> exts{".nxspe", ""};
   declareProperty(Kernel::make_unique<FileProperty>("Filename", "",
                                                     FileProperty::Load, exts),
                   "An NXSPE file");
diff --git a/Framework/DataHandling/src/SaveDiffFittingAscii.cpp b/Framework/DataHandling/src/SaveDiffFittingAscii.cpp
index 94d8697fc84..d4fd996d230 100644
--- a/Framework/DataHandling/src/SaveDiffFittingAscii.cpp
+++ b/Framework/DataHandling/src/SaveDiffFittingAscii.cpp
@@ -35,7 +35,7 @@ void SaveDiffFittingAscii::init() {
 
   // Declare required parameters, filename with ext {.his} and input
   // workspace
-  const std::vector<std::string> exts{".txt", ".csv"};
+  const std::vector<std::string> exts{".txt", ".csv", ""};
   declareProperty(Kernel::make_unique<API::FileProperty>(
                       "Filename", "", API::FileProperty::Save, exts),
                   "The filename to use for the saved data");
diff --git a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp
index dc35b65be66..65114521c08 100644
--- a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp
+++ b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp
@@ -37,7 +37,7 @@ void SaveOpenGenieAscii::init() {
 
   // Declare required parameters, filename with ext {.his} and input
   // workspace
-  const std::vector<std::string> exts{".his", ".txt"};
+  const std::vector<std::string> exts{".his", ".txt", ""};
   declareProperty(Kernel::make_unique<API::FileProperty>(
                       "Filename", "", API::FileProperty::Save, exts),
                   "The filename to use for the saved data");
diff --git a/qt/widgets/common/src/FileDialogHandler.cpp b/qt/widgets/common/src/FileDialogHandler.cpp
index 2a97322c806..ac439f52a8c 100644
--- a/qt/widgets/common/src/FileDialogHandler.cpp
+++ b/qt/widgets/common/src/FileDialogHandler.cpp
@@ -161,7 +161,7 @@ QString getFilter(const std::vector<std::string> &exts) {
  */
 QString formatExtension(const std::string &extension) {
   QString formattedExtension = QString::fromStdString(extension);
-  if (extension == "") {
+  if (extension.empty()) {
     return formattedExtension;
   }
   if (extension.at(0) == '*' && extension.at(1) == '.') {
@@ -171,7 +171,7 @@ QString formatExtension(const std::string &extension) {
       formattedExtension.insert(1, ".");
     } else if (extension.at(0) == '.') {
       formattedExtension.prepend("*");
-    } else {
+	} else {
       formattedExtension.prepend("*.");
     }
   }
-- 
GitLab