motif save should have a default extension.
authorDiane Trout <diane@caltech.edu>
Tue, 17 Oct 2006 20:41:32 +0000 (20:41 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 17 Oct 2006 20:41:32 +0000 (20:41 +0000)
ticket:188

qui/MussaWindow.cpp

index 36727a1635dd617670561688798bd5d789e0d855..640d6f8448337cfe654de89e349d649b42891c5e 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/convenience.hpp>
 namespace fs = boost::filesystem;
 #include <boost/bind.hpp>
 
@@ -465,6 +466,10 @@ void MussaWindow::saveMotifList()
   // try to load safely
   try {
     fs::path converted_path(path.toStdString(), fs::native);
+    if (fs::extension(converted_path).size() == 0) {
+      // no extension, so add one
+      converted_path = converted_path.string() + ".mtl";
+    }
     analysis->save_motifs(converted_path);
     default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
   } catch (runtime_error e) {