diff --git a/QtScrcpy/adb/adbprocess.cpp b/QtScrcpy/adb/adbprocess.cpp index 43a09a9..7eb4e2c 100644 --- a/QtScrcpy/adb/adbprocess.cpp +++ b/QtScrcpy/adb/adbprocess.cpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "adbprocess.h" @@ -23,7 +25,8 @@ const QString& AdbProcess::getAdbPath() { if (s_adbPath.isEmpty()) { s_adbPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_ADB_PATH")); - if (s_adbPath.isEmpty()) { + QFileInfo fileInfo(s_adbPath); + if (s_adbPath.isEmpty() || !fileInfo.isFile()) { s_adbPath = QCoreApplication::applicationDirPath() + "/adb"; } } diff --git a/QtScrcpy/server/server.cpp b/QtScrcpy/server/server.cpp index 58fe266..b4450ee 100644 --- a/QtScrcpy/server/server.cpp +++ b/QtScrcpy/server/server.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "server.h" @@ -52,7 +53,8 @@ const QString& Server::getServerPath() { if (m_serverPath.isEmpty()) { m_serverPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_SERVER_PATH")); - if (m_serverPath.isEmpty()) { + QFileInfo fileInfo(m_serverPath); + if (m_serverPath.isEmpty() || !fileInfo.isFile()) { m_serverPath = QCoreApplication::applicationDirPath() + "/scrcpy-server.jar"; } }