mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
changed the check for is a file using stat and not looking for a dot in file name
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@117 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -285,12 +285,24 @@ void qDetectorMain::LoadConfigFile(const string fName){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading config file at start up:" << fName << endl;
|
||||
#endif
|
||||
QString file = QString(fName.c_str());//.section('/',-1);
|
||||
if((file.contains('.'))&&(QFile::exists(file))){
|
||||
if(myDet->readConfigurationFile(fName)!=slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","Main");
|
||||
else qDefs::Message(qDefs::WARNING,string("<nobr>Could not load the Configuration Parameters at start up from file:</nobr><br><nobr>")+fName,"Main");
|
||||
}else qDefs::Message(qDefs::WARNING,string("<nobr>Start up configuration failed to load. The following file does not exist:</nobr><br><nobr>")+fName,"Main");
|
||||
struct stat st_buf;
|
||||
QString file = QString(fName.c_str());
|
||||
|
||||
//path doesnt exist
|
||||
if(stat(fName.c_str(),&st_buf))
|
||||
qDefs::Message(qDefs::WARNING,string("<nobr>Start up configuration failed to load. The following file does not exist:</nobr><br><nobr>")+fName,"Main");
|
||||
|
||||
//not a file
|
||||
else if (!S_ISREG (st_buf.st_mode))
|
||||
qDefs::Message(qDefs::WARNING,string("<nobr>Start up configuration failed to load. The following file is not a recognized file format:</nobr><br><nobr>")+fName,"Main");
|
||||
|
||||
//could not load config file
|
||||
else if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","Main");
|
||||
|
||||
//successful
|
||||
else
|
||||
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","Main");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user