more flexible handling of startup XML's

This commit is contained in:
nemu
2009-03-25 13:05:55 +00:00
parent df7f36de2f
commit b38e8beffc
6 changed files with 72 additions and 41 deletions

View File

@ -97,22 +97,11 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// get default path (for the moment only linux like)
char *pmusrpath;
char musrpath[128];
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath == 0) { // not set, will try default one
strcpy(musrpath, "/home/nemu/analysis/bin");
cout << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
} else {
strncpy(musrpath, pmusrpath, sizeof(musrpath));
}
// read startup file
char startup_path_name[128];
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
status = saxParser->ParseFile(startup_path_name);
// check for parse errors