From 30862e21d035b2ba88825379136ee012a1b5e89f Mon Sep 17 00:00:00 2001 From: "Bastian M. Wojek" Date: Mon, 23 Aug 2010 09:06:14 +0000 Subject: [PATCH] Fixed a problem with the MUSRFITPATH-variable introduced recently for msr2data --- ChangeLog | 1 - src/msr2data.cpp | 26 ++++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84813284..691800c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,6 @@ NEW integration of a few external musrfit plug-ins into the standard build proce NEW default estimates for 'data' and 'background' entries in RUN blocks NEW directory with some msr- and data-files for quick testing of new musrfit installations NEW option to musrt0: the key 'T' will set the t0 cursor to the maximum of the histogram -FIXED next attempt to fix the d-f-d (MUSR-115) issue FIXED formatting of the ASCII fit output file for long parameter names (MUSR-142) FIXED time window frame bug in musrview (MUSR-138) FIXED calculation of LF relaxation functions for big static widths (MUSR-139) diff --git a/src/msr2data.cpp b/src/msr2data.cpp index 8eed3286..eaf28bd6 100644 --- a/src/msr2data.cpp +++ b/src/msr2data.cpp @@ -502,13 +502,16 @@ int main(int argc, char *argv[]) // and do the fitting if (!onlyInputCreation) { // check if MUSRFITPATH is set, if not issue a warning - string path(getenv("MUSRFITPATH")); - if (path.empty()) { - cerr << endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!" << endl; - cerr << endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << endl; - } else { + string path; + try { + path = boost::lexical_cast(getenv("MUSRFITPATH")); path.append("/"); } + catch(boost::bad_lexical_cast &) { + cerr << endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!"; + cerr << endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << endl; + path = ""; + } ostringstream oss; oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; cout << endl << ">> msr2data: **INFO** Calling " << oss.str() << endl; @@ -582,13 +585,16 @@ int main(int argc, char *argv[]) // and do the fitting if (!onlyInputCreation) { // check if MUSRFITPATH is set, if not issue a warning - string path(getenv("MUSRFITPATH")); - if (path.empty()) { - cerr << endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!" << endl; - cerr << endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << endl; - } else { + string path; + try { + path = boost::lexical_cast(getenv("MUSRFITPATH")); path.append("/"); } + catch(boost::bad_lexical_cast &) { + cerr << endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!"; + cerr << endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << endl; + path = ""; + } ostringstream oss; oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; cout << endl << ">> msr2data: **INFO** Calling " << oss.str() << endl;