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.
This commit is contained in:
baldurk
2017-06-14 17:09:22 +01:00
committed by Baldur Karlsson
parent 6423a82d18
commit e0104e8fe0
5 changed files with 22 additions and 14 deletions
@@ -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;
@@ -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();
+2 -2
View File
@@ -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;
}
+16 -5
View File
@@ -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;
-3
View File
@@ -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)
{