Slight improvement when an empty MUSRFITPATH environment variable is set

This commit is contained in:
Bastian M. Wojek 2011-02-22 19:26:31 +00:00
parent c048dc4553
commit 9624e5171f
4 changed files with 20 additions and 4 deletions

View File

@ -14,6 +14,7 @@ NEW any2many: an attempt to write the universial musr-data-file converter. Just
NEW musrt0: added the possibility to show the t0 saved in the data file 's'. Furthermore added the option
--getT0FromPromptPeak, -g with <firstGoodBinOffset>: will, in non-interactive mode estimate the t0's from
the prompt peak and write it into the msr-file (MUSR-133).
FIXED accidental casting of a NULL pointer in msr2data
FIXED crash of musrfit if a run-data-files is not found (MUSR-176)
FIXED corrected time resolution for WKM from (ns) -> (us)
FIXED the formating of fixed parameters (step=0) where wrongly formatted (connected to MUSR-167). This

View File

@ -1305,13 +1305,16 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
// and do the fitting
// check if MUSRFITPATH is set, if not issue a warning
string path("");
bool pathSet(false);
char *pathPtr(getenv("MUSRFITPATH"));
if (pathPtr) {
path = boost::lexical_cast<string>(pathPtr);
if (!path.empty()) {
pathSet = true;
path.append("/");
}
} else {
}
if (!pathSet) {
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;
}

View File

@ -58,6 +58,7 @@ PStartupHandler::PStartupHandler()
Char_t *home;
Char_t musrpath[128];
Char_t startup_path_name[128];
Bool_t pmusrpathfound = false;
// check if the startup file is found in the current directory
strcpy(startup_path_name, "./musrfit_startup.xml");
@ -67,7 +68,12 @@ PStartupHandler::PStartupHandler()
} else { // startup file is not found in the current directory
// check if the MUSRFITPATH system variable is set
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath == 0) { // not set, will try default one
if (pmusrpath != 0) {
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
pmusrpathfound = true;
}
}
if (!pmusrpathfound) { // MUSRFITPATH not set or empty, will try default one
home = getenv("ROOTSYS");
sprintf(musrpath, "%s/bin", home);
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;

View File

@ -690,13 +690,16 @@ int main(int argc, char *argv[])
if (!onlyInputCreation) {
// check if MUSRFITPATH is set, if not issue a warning
string path("");
bool pathSet(false);
char *pathPtr(getenv("MUSRFITPATH"));
if (pathPtr) {
path = boost::lexical_cast<string>(pathPtr);
if (!path.empty()) {
pathSet = true;
path.append("/");
}
} else {
}
if (!pathSet) {
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;
}
@ -776,13 +779,16 @@ int main(int argc, char *argv[])
if (!onlyInputCreation) {
// check if MUSRFITPATH is set, if not issue a warning
string path("");
bool pathSet(false);
char *pathPtr(getenv("MUSRFITPATH"));
if (pathPtr) {
path = boost::lexical_cast<string>(pathPtr);
if (!path.empty()) {
pathSet = true;
path.append("/");
}
} else {
}
if (!pathSet) {
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;
}