From 23ab40cc63c16ddafd0d16d765821c4ea0a4ab62 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 19 Apr 2006 01:53:10 +0000 Subject: [PATCH] win32 paths need some conversion 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 | 2 +- mussa_exceptions.hpp | 1 + mussagl.pro | 5 ++++- qui/MussaWindow.cpp | 12 ++++++++--- qui/mussa_setup_dialog/MussaSetupWidget.cpp | 13 +++++++----- qui/mussagl.cpp | 23 +++++++++++++++------ 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/alg/glseqbrowser.cpp b/alg/glseqbrowser.cpp index 1c9ea84..ae9ed77 100644 --- a/alg/glseqbrowser.cpp +++ b/alg/glseqbrowser.cpp @@ -334,7 +334,7 @@ GlSeqBrowser::link(const vector& path, const vector& 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"); } diff --git a/mussa_exceptions.hpp b/mussa_exceptions.hpp index bf76e3b..f9ee710 100644 --- a/mussa_exceptions.hpp +++ b/mussa_exceptions.hpp @@ -1,6 +1,7 @@ #ifndef _MUSSA_EXCEPTIONS_H_ #define _MUSSA_EXCEPTIONS_H_ #include +#include //! base mussa exception class mussa_error : public std::runtime_error diff --git a/mussagl.pro b/mussagl.pro index 51022d3..74e7103 100644 --- a/mussagl.pro +++ b/mussagl.pro @@ -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 diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index 9e0678c..e11e586 100644 --- a/qui/MussaWindow.cpp +++ b/qui/MussaWindow.cpp @@ -15,6 +15,9 @@ #include +#include +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) { diff --git a/qui/mussa_setup_dialog/MussaSetupWidget.cpp b/qui/mussa_setup_dialog/MussaSetupWidget.cpp index 79f0584..279231b 100644 --- a/qui/mussa_setup_dialog/MussaSetupWidget.cpp +++ b/qui/mussa_setup_dialog/MussaSetupWidget.cpp @@ -10,6 +10,9 @@ using namespace std; +#include +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(); diff --git a/qui/mussagl.cpp b/qui/mussagl.cpp index bc6260f..919c329 100644 --- a/qui/mussagl.cpp +++ b/qui/mussagl.cpp @@ -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; } -- 2.30.2