mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-16 22:21:30 +08:00
Fix #15 partially
The path of the start script or the client can contain spaces now(on Windows) TODO: Test the issue on Linux and implement the fix if it's needed Support non-ASCII chars in the path
This commit is contained in:
parent
1bec73d1ad
commit
a232e4ec83
@ -123,15 +123,24 @@ void MainWindow::on_PM3_connectButton_clicked()
|
|||||||
if(envScriptPath.exists())
|
if(envScriptPath.exists())
|
||||||
{
|
{
|
||||||
qDebug() << envScriptPath.absoluteFilePath();
|
qDebug() << envScriptPath.absoluteFilePath();
|
||||||
|
// use the shell session to keep the environment then read it
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// cmd /c "<path>">>nul && set
|
// cmd /c "<path>">>nul && set
|
||||||
envSetProcess.start("cmd /c \"" + envScriptPath.absoluteFilePath() + "\">>nul && set");
|
envSetProcess.start("cmd");
|
||||||
|
envSetProcess.write(QString("\"" + envScriptPath.absoluteFilePath() + "\">>nul\r\n").toLatin1());
|
||||||
|
envSetProcess.waitForReadyRead(10000);
|
||||||
|
envSetProcess.readAll();
|
||||||
|
envSetProcess.write("set\r\n");
|
||||||
#else
|
#else
|
||||||
|
// need implementation(or test if space works)
|
||||||
// sh -c '. "<path>">>/dev/null && env'
|
// sh -c '. "<path>">>/dev/null && env'
|
||||||
envSetProcess.start("sh -c \' . \"" + envScriptPath.absoluteFilePath() + "\">>/dev/null && env");
|
envSetProcess.start("sh -c \' . \"" + envScriptPath.absoluteFilePath() + "\">>/dev/null && env");
|
||||||
#endif
|
#endif
|
||||||
envSetProcess.waitForReadyRead(10000);
|
envSetProcess.waitForReadyRead(10000);
|
||||||
clientEnv = QString(envSetProcess.readAll()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
|
QString test = QString(envSetProcess.readAll());
|
||||||
|
clientEnv = test.split(QRegExp("[\r\n]{1,2}"), QString::SkipEmptyParts);
|
||||||
|
clientEnv.removeFirst();
|
||||||
|
qDebug() << clientEnv;
|
||||||
// qDebug() << "Get Env List" << clientEnv;
|
// qDebug() << "Get Env List" << clientEnv;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -152,7 +161,7 @@ void MainWindow::on_PM3_connectButton_clicked()
|
|||||||
else if(!keepClientActive)
|
else if(!keepClientActive)
|
||||||
emit setSerialListener(false);
|
emit setSerialListener(false);
|
||||||
|
|
||||||
|
envSetProcess.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onPM3StateChanged(bool st, const QString& info)
|
void MainWindow::onPM3StateChanged(bool st, const QString& info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user