Add android::base::GetExecutablePath, switch adb and fastboot over.
We'd long had two copies of this stuff, so rather than rewrite both
Linux versions to use android::base::Readlink, let's kill the duplication
too...
Bug: http://b/30988271
Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index df0f651..987ba83 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -47,6 +47,7 @@
#include <utility>
#include <vector>
+#include <android-base/file.h>
#include <android-base/macros.h>
#include <android-base/parseint.h>
#include <android-base/parsenetaddress.h>
@@ -116,7 +117,7 @@
static std::string find_item_given_name(const char* img_name, const char* product) {
if(product) {
- std::string path = get_my_path();
+ std::string path = android::base::GetExecutablePath();
path.erase(path.find_last_of('/'));
return android::base::StringPrintf("%s/../../../target/product/%s/%s",
path.c_str(), product, img_name);