improved handling for invalid MUSRFITPATH
This commit is contained in:
parent
5c05a34282
commit
6f49067095
@ -74,9 +74,9 @@ PStartupHandler::PStartupHandler()
|
||||
strncpy(musrpath, pmusrpath, sizeof(musrpath));
|
||||
}
|
||||
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
if (StartupFileExists(startup_path_name)) {
|
||||
fStartupFileFound = true;
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -406,13 +406,9 @@ int main(int argc, char *argv[])
|
||||
char startup_path_name[128];
|
||||
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
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cout << endl;
|
||||
if (!startupHandler->StartupFileFound()) {
|
||||
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
@ -422,6 +418,24 @@ int main(int argc, char *argv[])
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
} else {
|
||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
}
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// read msr-file
|
||||
|
@ -172,14 +172,9 @@ int main(int argc, char *argv[])
|
||||
char startup_path_name[128];
|
||||
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
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing musrfit_startup.xml failed.";
|
||||
cout << endl;
|
||||
/*
|
||||
if (!startupHandler->StartupFileFound()) {
|
||||
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
@ -189,9 +184,25 @@ int main(int argc, char *argv[])
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
}
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
// read msr-file
|
||||
PMsrHandler *msrHandler = new PMsrHandler(filename);
|
||||
|
@ -145,24 +145,38 @@ int main(int argc, char *argv[])
|
||||
char startup_path_name[128];
|
||||
TSAXParser *saxParser = new TSAXParser();
|
||||
PStartupHandler *startupHandler = new PStartupHandler();
|
||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing musrfit_startup.xml failed.";
|
||||
cout << endl;
|
||||
if (!startupHandler->StartupFileFound()) {
|
||||
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
}
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
} else {
|
||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cerr << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
}
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
// read msr-file
|
||||
PMsrHandler *msrHandler = new PMsrHandler(fileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user