Merge "Show install path in "adb --version" and "fastboot --version"."

This commit is contained in:
Elliott Hughes 2017-04-04 01:16:10 +00:00 committed by Gerrit Code Review
commit d2d8b68f70
2 changed files with 7 additions and 4 deletions

View file

@ -59,10 +59,12 @@ using namespace std::chrono_literals;
std::string adb_version() { std::string adb_version() {
// Don't change the format of this --- it's parsed by ddmlib. // Don't change the format of this --- it's parsed by ddmlib.
return android::base::StringPrintf("Android Debug Bridge version %d.%d.%d\n" return android::base::StringPrintf(
"Revision %s\n", "Android Debug Bridge version %d.%d.%d\n"
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, "Revision %s\n"
ADB_REVISION); "Installed as %s\n",
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_REVISION,
android::base::GetExecutablePath().c_str());
} }
void fatal(const char *fmt, ...) { void fatal(const char *fmt, ...) {

View file

@ -1539,6 +1539,7 @@ int main(int argc, char **argv)
setvbuf(stderr, nullptr, _IONBF, 0); setvbuf(stderr, nullptr, _IONBF, 0);
} else if (strcmp("version", longopts[longindex].name) == 0) { } else if (strcmp("version", longopts[longindex].name) == 0) {
fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION); fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION);
fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
return 0; return 0;
} else if (strcmp("slot", longopts[longindex].name) == 0) { } else if (strcmp("slot", longopts[longindex].name) == 0) {
slot_override = std::string(optarg); slot_override = std::string(optarg);