win32 paths need some conversion
authorDiane Trout <diane@caltech.edu>
Wed, 19 Apr 2006 01:53:10 +0000 (01:53 +0000)
committerDiane Trout <diane@caltech.edu>
Wed, 19 Apr 2006 01:53:10 +0000 (01:53 +0000)
boosts native path type doesn't match win32
conventions quite correctly so before passing
a user entered file name we need to convert it.***END OF DESCRIPTION***

Place the long patch description above the ***END OF DESCRIPTION*** marker.
The first line of this file will be the patch name.

This patch contains the following changes:

M ./alg/glseqbrowser.cpp -1 +1
M ./mussa_exceptions.hpp +1
M ./mussagl.pro -1 +4
M ./qui/MussaWindow.cpp -3 +9
M ./qui/mussa_setup_dialog/MussaSetupWidget.cpp -5 +8
M ./qui/mussagl.cpp -6 +17

alg/glseqbrowser.cpp
mussa_exceptions.hpp
mussagl.pro
qui/MussaWindow.cpp
qui/mussa_setup_dialog/MussaSetupWidget.cpp
qui/mussagl.cpp

index 1c9ea84dc48c202257d69f4b222e4a680e400f4b..ae9ed776eae1ba6f6fe5a289b31e4cf8119a387a 100644 (file)
@@ -334,7 +334,7 @@ GlSeqBrowser::link(const vector<int>& path, const vector<bool>& rc, int )
     msg << "Path size [" << path.size() << "] and track size [" 
         << track_container.size() << "] don't match" << endl;
     throw mussa_error(msg.str());
- }
 }
   if (path.size() != rc.size()) {
     throw runtime_error("path and reverse compliment must be the same length");
   }
index bf76e3b946eb0b166bfc4ec1a0175f3c2dd4300c..f9ee710df2834d24a5fe1cbe6d32f289c676ad51 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _MUSSA_EXCEPTIONS_H_
 #define _MUSSA_EXCEPTIONS_H_
 #include <stdexcept>
+#include <boost/filesystem/exception.hpp>
 
 //! base mussa exception
 class mussa_error : public std::runtime_error
index 51022d392bab417150b725a1420d4bc8bbb03a09..74e710367b2ff80b6bb308103ca904098ea42aff 100644 (file)
@@ -78,9 +78,12 @@ RESOURCES = icons.qrc
 
 LIBS += -lm 
 QT += opengl
-LIBS += -lboost_program_options -lboost_filesystem
+LIBS += -lboost_program_options
+LIBS += -lboost_filesystem
 
 win32 {
+  MINGW_HOME = C:/MinGW
+  INCLUDEPATH += $$MINGW_HOME/include/GL
   BOOST_HOME = c:/Boost
   INCLUDEPATH += $$BOOST_HOME/include/boost-1_33_1
   LIBS -= -lboost_program_options
index 9e0678c57137ff53b7f859ee7a799bda6a32e676..e11e586772994fb566fcbf6bb75188195ca248e2 100644 (file)
@@ -15,6 +15,9 @@
 
 #include <iostream>
 
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
 using namespace std;
 
 MussaWindow::MussaWindow(Mussa *analysis_, QWidget *parent) :
@@ -243,7 +246,8 @@ void MussaWindow::loadMotifList()
     return;
   // try to load safely
   try {
-    analysis->load_motifs(path.toStdString());
+    fs::path converted_path(path.toStdString(), fs::native);
+    analysis->load_motifs(converted_path);
   } catch (runtime_error e) {
     QString msg("Unable to load ");
     msg += path;
@@ -273,7 +277,8 @@ void MussaWindow::loadMupa()
   // try to load safely
   try {
     Mussa *m = new Mussa;
-    m->load_mupa_file(mupa_path.toStdString());
+    fs::path converted_path(mupa_path.toStdString(), fs::native);
+    m->load_mupa_file(converted_path);
     m->analyze(0, 0, Mussa::TransitiveNway, 0.0);
     setAnalysis(m);
   } catch (mussa_load_error e) {
@@ -298,7 +303,8 @@ void MussaWindow::loadSavedAnalysis()
   // try to safely load
   try {
     Mussa *m = new Mussa;
-    m->load(muway_dir.toStdString());
+    fs::path converted_path(muway_dir.toStdString(), fs::native);
+    m->load(converted_path);
     // only switch mussas if we loaded without error
     setAnalysis(m);
   } catch (mussa_load_error e) {
index 79f05842d96290b4f933858d0aecca6446bc49e0..279231b940ed09302a4e402c0c7d79e178e66472 100644 (file)
@@ -10,6 +10,9 @@
 
 using namespace std;
 
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
 //#include "qui/mussa_setup_dialog/SequenceSetupWidget.hpp"
 #include "qui/mussa_setup_dialog/SequenceSetupFrame.hpp"
 #include "qui/mussa_setup_dialog/MussaSetupWidget.hpp"
@@ -98,8 +101,6 @@ Mussa* MussaSetupWidget::getMussaObject()
 {
   Mussa *mussa = new Mussa;
 
-  std::string seqFile;
-  std::string annotFile;
   int fastaIndex;
   int start;
   int end;
@@ -110,12 +111,14 @@ Mussa* MussaSetupWidget::getMussaObject()
        setup_item != setupInfoList.end();
        ++setup_item)
   {
-    seqFile = (*setup_item)->getSeqFile();
-    annotFile = (*setup_item)->getAnnotFile();
+    std::string seqNative = (*setup_item)->getSeqFile();
+    std::string annotNative = (*setup_item)->getAnnotFile();
     fastaIndex = (*setup_item)->getFastaIndex();
     start = (*setup_item)->getSubSeqStart();
     end = (*setup_item)->getSubSeqEnd();
-   
+  
+    fs::path seqFile(seqNative, fs::native);
+    fs::path annotFile(annotNative, fs::native);
     mussa->load_sequence(seqFile, annotFile, fastaIndex, start, end);
   }
   setupInfoList.clear();
index bc6260f42813ac2df668728bad966642d2548768..919c3293b8d8fcb7d62b933d66cb394ce42b0c84 100644 (file)
@@ -6,6 +6,7 @@ using namespace boost::filesystem;
 
 #include "qui/MussaWindow.hpp"
 #include "alg/parse_options.hpp"
+#include "mussa_exceptions.hpp"
 
 int main(int argc, char **argv)
 {
@@ -25,11 +26,21 @@ int main(int argc, char **argv)
     return 1;
   }
 
-  if (opts.useGUI) { 
-    MussaWindow win(opts.analysis);
-    win.show();
-    app.exec();
+  try {
+    if (opts.useGUI) { 
+      MussaWindow win(opts.analysis);
+      win.show();
+      app.exec();
+    }
+    return 0;
+  } catch (mussa_error e) {
+    qFatal(e.what());
+  } catch (boost::filesystem::filesystem_error e) {
+    qFatal(e.what());
+  } catch (std::runtime_error e) {
+    qFatal(e.what());
+  } catch (...) {
+    qFatal("unrecognized exception");
   }
-
-  return 0;
+  return 1;
 }