From d722b018c3d2297cb4af76d3bce1477438372354 Mon Sep 17 00:00:00 2001 From: "Bastian M. Wojek" Date: Sat, 21 Aug 2010 13:50:20 +0000 Subject: [PATCH] Implement some PATH-setting-workaround for msr2data in order to offer an easy way to find the executables (through MUSRFITPATH) --- src/msr2data.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/msr2data.cpp b/src/msr2data.cpp index 032b4a2e..8eed3286 100644 --- a/src/msr2data.cpp +++ b/src/msr2data.cpp @@ -39,6 +39,7 @@ #include #include #include +#include using namespace std; @@ -500,8 +501,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 { + path.append("/"); + } ostringstream oss; - oss << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; + oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; cout << endl << ">> msr2data: **INFO** Calling " << oss.str() << endl; system(oss.str().c_str()); } @@ -572,8 +581,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 { + path.append("/"); + } ostringstream oss; - oss << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; + oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; cout << endl << ">> msr2data: **INFO** Calling " << oss.str() << endl; system(oss.str().c_str()); }