mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-16 22:21:30 +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 startArgs = ui->Set_Client_startArgsEdit->text();
|
||||||
QString clientPath = ui->PM3_pathBox->currentText();
|
QString clientPath = ui->PM3_pathBox->currentText();
|
||||||
QFileInfo clientFile(clientPath);
|
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);
|
QMessageBox::information(this, tr("Info"), tr("The client path is invalid"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user