diff --git a/src/QtScrcpy.pro b/src/QtScrcpy.pro index c53bad3..9ae4d1e 100644 --- a/src/QtScrcpy.pro +++ b/src/QtScrcpy.pro @@ -39,7 +39,14 @@ FORMS += \ dialog.ui \ videoform.ui -#子工程 +# 指定可执行程序输出目录 +CONFIG(debug, debug|release) { + DESTDIR = $$PWD/../output/debug +} else { + DESTDIR = $$PWD/../output/release +} + +# 子工程 include ($$PWD/common/common.pri) include ($$PWD/server/server.pri) include ($$PWD/adb/adb.pri) diff --git a/src/adb/adbprocess.cpp b/src/adb/adbprocess.cpp index 99b8705..ad95e5d 100644 --- a/src/adb/adbprocess.cpp +++ b/src/adb/adbprocess.cpp @@ -1,9 +1,9 @@ -#include "adbprocess.h" - #include #include #include +#include "adbprocess.h" + QString AdbProcess::s_adbPath = ""; AdbProcess::AdbProcess(QObject *parent) @@ -24,7 +24,7 @@ const QString& AdbProcess::getAdbPath() if (s_adbPath.isEmpty()) { s_adbPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_ADB_PATH")); if (s_adbPath.isEmpty()) { - s_adbPath = "adb"; + s_adbPath = QCoreApplication::applicationDirPath() + "/adb"; } } return s_adbPath; @@ -49,7 +49,7 @@ void AdbProcess::initSignals() }); connect(this, &QProcess::errorOccurred, this, - [this](QProcess::ProcessError error){ + [this](QProcess::ProcessError error){ if (QProcess::FailedToStart == error) { emit adbProcessResult(AER_ERROR_MISSING_BINARY); } else { @@ -86,7 +86,6 @@ void AdbProcess::execute(const QString& serial, const QStringList& args) adbArgs << args; qDebug() << getAdbPath() << adbArgs.join(" "); start(getAdbPath(), adbArgs); - //start("C:\\Users\\Barry\\Desktop\\sockettool.exe", Q_NULLPTR); } bool AdbProcess::isRuning() diff --git a/src/main.cpp b/src/main.cpp index bec5615..ad2d5da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,8 +15,8 @@ int main(int argc, char *argv[]) Decoder::init(); QApplication a(argc, argv); - qputenv("QTSCRCPY_ADB_PATH", "G:\\mygitcode\\QtScrcpy\\src\\adb.exe"); - qputenv("QTSCRCPY_SERVER_PATH", "G:\\mygitcode\\QtScrcpy\\src\\scrcpy-server.jar"); + //qputenv("QTSCRCPY_ADB_PATH", "G:\\mygitcode\\QtScrcpy\\src\\adb.exe"); + //qputenv("QTSCRCPY_SERVER_PATH", "G:\\mygitcode\\QtScrcpy\\src\\scrcpy-server.jar"); Dialog* w = new Dialog; w->show(); diff --git a/src/server/server.cpp b/src/server/server.cpp index bd3ee7f..4fc2ec8 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "server.h" @@ -52,7 +53,7 @@ const QString& Server::getServerPath() if (m_serverPath.isEmpty()) { m_serverPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_SERVER_PATH")); if (m_serverPath.isEmpty()) { - m_serverPath = "scrcpy-server.jar"; + m_serverPath = QCoreApplication::applicationDirPath() + "/scrcpy-server.jar"; } } return m_serverPath;