mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +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:
@ -129,29 +129,30 @@ void qActionsWidget::SetScriptFile(){
|
||||
cout << "Setting\taction:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
bool set = false;
|
||||
struct stat st_buf;
|
||||
|
||||
//blank
|
||||
if(fName.isEmpty()) set = true;
|
||||
else if(!fName.compare("none")) set = true;
|
||||
if(fName.isEmpty())
|
||||
set = true;
|
||||
else if(!fName.compare("none"))
|
||||
set = true;
|
||||
//not blank
|
||||
else{
|
||||
QString file = dispScript->text().section('/',-1);
|
||||
//is a file
|
||||
if(file.contains('.')){
|
||||
//check if it exists and set the script file
|
||||
if(QFile::exists(fName)) set = true;
|
||||
//if the file doesnt exist, set it to what it was before
|
||||
else{
|
||||
qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
}//not a file, set it to what it was before
|
||||
else {
|
||||
//path doesnt exist
|
||||
if(stat(fName.toAscii().constData(),&st_buf)){
|
||||
qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
//if its not a file
|
||||
else if (!S_ISREG (st_buf.st_mode)) {
|
||||
qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
}
|
||||
else
|
||||
set=true;
|
||||
}
|
||||
|
||||
|
||||
//if blank or valid file
|
||||
if(set){
|
||||
//scan and positions wouldnt get here
|
||||
|
Reference in New Issue
Block a user