Fixed a problem with the MUSRFITPATH-variable introduced recently for msr2data

This commit is contained in:
Bastian M. Wojek
2010-08-23 09:06:14 +00:00
parent d722b018c3
commit 30862e21d0
2 changed files with 16 additions and 11 deletions

View File

@ -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<string>(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<string>(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;