From e0104e8fe0890155aa6bef20ea8a5d01cec71bb6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 14 Jun 2017 17:09:22 +0100 Subject: [PATCH] Allow configured adb path to be empty, look for adb in shipped path * On windows we ship adb.exe under android/ so that there's no configure needed. Look for that file if there isn't an override path. --- .../Code/Interface/PersistantConfig.cpp | 3 --- qrenderdoc/Windows/Dialogs/SettingsDialog.cpp | 5 ++++- renderdoc/os/win32/win32_process.cpp | 4 ++-- renderdoc/replay/entry_points.cpp | 21 ++++++++++++++----- renderdocui/Code/PersistantConfig.cs | 3 --- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/qrenderdoc/Code/Interface/PersistantConfig.cpp b/qrenderdoc/Code/Interface/PersistantConfig.cpp index 3923080fd..d24a58182 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.cpp +++ b/qrenderdoc/Code/Interface/PersistantConfig.cpp @@ -186,9 +186,6 @@ void PersistantConfig::AddAndroidHosts() // Set the config setting as it will be reused when we start the remoteserver etc. SetConfigSetting(lit("adbExePath"), adbExePath); - if(adbExePath.isEmpty()) - return; // adb path must be non-empty in the Options dialog. - SetConfigSetting(lit("MaxConnectTimeout"), QString::number(Android_MaxConnectTimeout)); rdctype::str androidHosts; diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp index 9743701b6..7d43963e5 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp @@ -347,7 +347,10 @@ void SettingsDialog::on_browseAdbPath_clicked() QFileInfo(m_Ctx.Config().Android_AdbExecutablePath).absoluteDir().path()); if(!adb.isEmpty()) + { + ui->Android_AdbExecutablePath->setText(adb); m_Ctx.Config().Android_AdbExecutablePath = adb; + } m_Ctx.Config().Save(); } @@ -361,7 +364,7 @@ void SettingsDialog::on_Android_MaxConnectTimeout_valueChanged(double timeout) void SettingsDialog::on_Android_AdbExecutablePath_textEdited(const QString &adb) { - if(QFileInfo::exists(adb)) + if(QFileInfo::exists(adb) || adb.isEmpty()) m_Ctx.Config().Android_AdbExecutablePath = adb; m_Ctx.Config().Save(); diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index c532f7073..6aaf339d8 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -472,7 +472,7 @@ static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, c if(!retValue) { - RDCERR("Process %s could not be loaded.", app); + RDCWARN("Process %s could not be loaded.", app); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); RDCEraseEl(pi); @@ -913,7 +913,7 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c if(pi.dwProcessId == 0) { - RDCERR("Couldn't launch process '%s'", app); + RDCWARN("Couldn't launch process '%s'", app); return 0; } diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index f449a35db..56cee1ac2 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -578,13 +578,24 @@ string adbExecCommand(const string &device, const string &args) string adbExePath = RenderDoc::Inst().GetConfigSetting("adbExePath"); if(adbExePath.empty()) { - static bool warnPath = true; - if(warnPath) + string exepath; + FileIO::GetExecutableFilename(exepath); + string exedir = dirname(FileIO::GetFullPathname(exepath)); + + string adbpath = exedir + "/android/adb.exe"; + if(FileIO::exists(adbpath.c_str())) + adbExePath = adbpath; + + if(adbExePath.empty()) { - RDCWARN("adbExePath not set, attempting to call 'adb' in working env"); - warnPath = false; + static bool warnPath = true; + if(warnPath) + { + RDCWARN("adbExePath not set, attempting to call 'adb' in working env"); + warnPath = false; + } + adbExePath = "adb"; } - adbExePath.append("adb"); } Process::ProcessResult result; string deviceArgs; diff --git a/renderdocui/Code/PersistantConfig.cs b/renderdocui/Code/PersistantConfig.cs index 263d9705d..44dc04e95 100644 --- a/renderdocui/Code/PersistantConfig.cs +++ b/renderdocui/Code/PersistantConfig.cs @@ -418,9 +418,6 @@ namespace renderdocui.Code // Set the config setting as it will be reused when we start the remoteserver etc. StaticExports.SetConfigSetting("adbExePath", adbExePath); - if (adbExePath.Length == 0) - return;// adb path must be non-empty in the Options dialog. - string[] androidHosts = StaticExports.EnumerateAndroidDevices(); foreach(string hostName in androidHosts) {