summaryrefslogtreecommitdiffstats
path: root/adb/commandline.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-21 10:17:07 -0700
committerElliott Hughes <enh@google.com>2015-04-21 10:17:07 -0700
commitd236d071b960a387f536712f0314b99696167178 (patch)
tree637ba3de06ea38866ac24034fc4f186f3929afee /adb/commandline.cpp
parente434ad1dd799551830019a7bd2871dec226bdcd2 (diff)
downloadsystem_core-d236d071b960a387f536712f0314b99696167178.zip
system_core-d236d071b960a387f536712f0314b99696167178.tar.gz
system_core-d236d071b960a387f536712f0314b99696167178.tar.bz2
Fix "adb sync" for devices without vendor and oem.
Bug: http://b/20440110 Change-Id: I2481992198890f5ca50412c2b7ca361101961413
Diffstat (limited to 'adb/commandline.cpp')
-rw-r--r--adb/commandline.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index f193d2f..58e1ade 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -1457,27 +1457,27 @@ int adb_commandline(int argc, const char **argv)
return uninstall_app(ttype, serial, argc, argv);
}
else if (!strcmp(argv[0], "sync")) {
- std::string src_arg;
+ std::string src;
bool list_only = false;
if (argc < 2) {
// No local path was specified.
- src_arg = "";
+ src = "";
} else if (argc >= 2 && strcmp(argv[1], "-l") == 0) {
- list_only = 1;
+ list_only = true;
if (argc == 3) {
- src_arg = argv[2];
+ src = argv[2];
} else {
- src_arg = "";
+ src = "";
}
} else if (argc == 2) {
// A local path or "android"/"data" arg was specified.
- src_arg = argv[1];
+ src = argv[1];
} else {
return usage();
}
- if (src_arg != "" &&
- src_arg != "system" && src_arg != "data" && src_arg != "vendor" && src_arg != "oem") {
+ if (src != "" &&
+ src != "system" && src != "data" && src != "vendor" && src != "oem") {
return usage();
}
@@ -1485,25 +1485,19 @@ int adb_commandline(int argc, const char **argv)
std::string data_src_path = product_file("data");
std::string vendor_src_path = product_file("vendor");
std::string oem_src_path = product_file("oem");
- if (!directory_exists(vendor_src_path)) {
- vendor_src_path = "";
- }
- if (!directory_exists(oem_src_path)) {
- oem_src_path = "";
- }
int rc = 0;
- if (rc == 0 && (src_arg.empty() || src_arg == "system")) {
- rc = do_sync_sync(system_src_path.c_str(), "/system", list_only);
+ if (rc == 0 && (src.empty() || src == "system")) {
+ rc = do_sync_sync(system_src_path, "/system", list_only);
}
- if (rc == 0 && (src_arg.empty() || src_arg == "vendor")) {
- rc = do_sync_sync(vendor_src_path.c_str(), "/vendor", list_only);
+ if (rc == 0 && (src.empty() || src == "vendor") && directory_exists(vendor_src_path)) {
+ rc = do_sync_sync(vendor_src_path, "/vendor", list_only);
}
- if(rc == 0 && (src_arg.empty() || src_arg == "oem")) {
- rc = do_sync_sync(oem_src_path.c_str(), "/oem", list_only);
+ if (rc == 0 && (src.empty() || src == "oem") && directory_exists(oem_src_path)) {
+ rc = do_sync_sync(oem_src_path, "/oem", list_only);
}
- if (rc == 0 && (src_arg.empty() || src_arg == "data")) {
- rc = do_sync_sync(data_src_path.c_str(), "/data", list_only);
+ if (rc == 0 && (src.empty() || src == "data")) {
+ rc = do_sync_sync(data_src_path, "/data", list_only);
}
return rc;
}