From 9e31496131d7324165340c83a93dc7a738abbef3 Mon Sep 17 00:00:00 2001 From: wh201906 Date: Fri, 12 Mar 2021 11:59:51 +0800 Subject: [PATCH] Fail to support non-ASCII chars in path Using "chcp" seems to have no effect there I fix a small bug then --- ui/mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index f9388a4..909e945 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -139,13 +139,17 @@ void MainWindow::on_PM3_connectButton_clicked() envSetProcess.waitForReadyRead(10000); QString test = QString(envSetProcess.readAll()); clientEnv = test.split(QRegExp("[\r\n]{1,2}"), QString::SkipEmptyParts); - clientEnv.removeFirst(); + if(clientEnv.size() > 2) // the first element is "set" and the last element is the current path + { + clientEnv.removeFirst(); + clientEnv.removeLast(); + emit setProcEnv(&clientEnv); + } qDebug() << clientEnv; // qDebug() << "Get Env List" << clientEnv; } else clientEnv.clear(); - emit setProcEnv(&clientEnv); clientWorkingDir->setPath(QApplication::applicationDirPath()); qDebug() << clientWorkingDir->absolutePath();