Move adb_dirname and adb_basename to libbase
adb already provides an implementation of dirname and basename that
take and produce std::strings, move it into libbase so it can be
used in the implementation of GetExecutableDirectory.
Test: out/host/linux-x86/nativetest64/adb_test/adb_test
Test: out/host/linux-x86/nativetest64/libbase_test/libbase_test
Test: adb shell /data/nativetest64/libbase_test/libbase_test64
Change-Id: Ideb1627607b14562121316d4ed27fa6fb0930684
diff --git a/bugreport.cpp b/bugreport.cpp
index b7e76a6..a5c312b 100644
--- a/bugreport.cpp
+++ b/bugreport.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include <android-base/file.h>
#include <android-base/strings.h>
#include "sysdeps.h"
@@ -113,14 +114,14 @@
private:
void SetLineMessage(const std::string& action) {
- line_message_ = action + " " + adb_basename(dest_file_);
+ line_message_ = action + " " + android::base::Basename(dest_file_);
}
void SetSrcFile(const std::string path) {
src_file_ = path;
if (!dest_dir_.empty()) {
// Only uses device-provided name when user passed a directory.
- dest_file_ = adb_basename(path);
+ dest_file_ = android::base::Basename(path);
SetLineMessage("generating");
}
}