Implement some PATH-setting-workaround for msr2data in order to offer an easy way to find the executables (through MUSRFITPATH)

This commit is contained in:
Bastian M. Wojek 2010-08-21 13:50:20 +00:00
parent 0d4dc340ad
commit d722b018c3

View File

@ -39,6 +39,7 @@
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdlib>
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());
}