mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-03-03 13:27:39 +08:00
Fix a bug in finding client
In commit e6be456cfa, I uses QFileInfo::exists() to check if the client exists. However, it doesn't work for client with extensions in environment variable %PATHEXT% when specifying the path without extension
This commit is contained in:
parent
99bb58adf9
commit
ee7aeda91e
@ -170,8 +170,29 @@ void MainWindow::on_PM3_connectButton_clicked()
|
||||
QString startArgs = ui->Set_Client_startArgsEdit->text();
|
||||
QString clientPath = ui->PM3_pathBox->currentText();
|
||||
QFileInfo clientFile(clientPath);
|
||||
bool clientExist = false;
|
||||
|
||||
if(!clientFile.exists())
|
||||
QStringList extList = {""};
|
||||
#ifdef Q_OS_WIN
|
||||
if(clientFile.suffix().isEmpty())
|
||||
{
|
||||
QString pathExt = QProcessEnvironment::systemEnvironment().value("pathext");
|
||||
extList += pathExt.split(";", Qt::SkipEmptyParts);
|
||||
if(extList.size() == 1)
|
||||
extList += ".exe";
|
||||
}
|
||||
#endif
|
||||
for(const QString& ext : extList)
|
||||
{
|
||||
QFileInfo executable(clientFile.filePath() + ext);
|
||||
if(executable.isFile())
|
||||
{
|
||||
clientExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!clientExist)
|
||||
{
|
||||
QMessageBox::information(this, tr("Info"), tr("The client path is invalid"), QMessageBox::Ok);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user