From 508e7eaef4b34a941b5047df8e9e2675ab7799e3 Mon Sep 17 00:00:00 2001 From: houchengqiu Date: Tue, 10 Sep 2024 11:44:44 +0800 Subject: [PATCH] fix: [cmd] remove bash use remove bash use Log: remove bash use Task: https://pms.uniontech.com/task-view-362321.html --- src/src/mainwindow/mainwindow.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/src/mainwindow/mainwindow.cpp b/src/src/mainwindow/mainwindow.cpp index 8b6fd593..8660fbb6 100644 --- a/src/src/mainwindow/mainwindow.cpp +++ b/src/src/mainwindow/mainwindow.cpp @@ -44,21 +44,8 @@ MainWindow::MainWindow(QWidget *parent) //检查OCR是否存在 try { - QProcess bash; - bash.start("bash"); - bash.waitForStarted(); - bash.write("command -v deepin-ocr"); - bash.closeWriteChannel(); - if (!bash.waitForFinished()) { - qWarning() << bash.errorString(); - m_ocrIsExisted = false; - } - auto output = bash.readAllStandardOutput(); - if (output.isEmpty()) { - m_ocrIsExisted = false; - } else { - m_ocrIsExisted = true; - } + QString path = QStandardPaths::findExecutable("deepin-ocr"); + m_ocrIsExisted = !path.isEmpty(); } catch (std::logic_error &e) { qWarning() << e.what(); m_ocrIsExisted = false;