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