android 强制修改adb pull 文件的路径

#强制修改adb pull 文件的路径
diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c
index 7933858..fa4afc5 100644
--- a/adb/file_sync_service.c
+++ b/adb/file_sync_service.c
@@ -432,6 +432,10 @@ void file_sync_service(int fd, void *cookie)
     char *buffer = malloc(SYNC_DATA_MAX);
     if(buffer == 0) goto fail;


+    char* storage_path_device = malloc(256);
+    const char* holo_path = "/storage/emulated/legacy/cts-holo-assets/";
+    const char* external_storage = getenv("EXTERNAL_STORAGE");
+
     for(;;) {
         D("sync: waiting for command\n");


@@ -450,6 +454,15 @@ void file_sync_service(int fd, void *cookie)
         }
         name[namelen] = 0;


+        if (!strncmp(name, holo_path, strlen(holo_path))) {
+            char* cts_file_path = (char *)name + strlen(holo_path);
+            D("sync: cts_file_path = %s\n", cts_file_path);
+            /* sprintf(storage_path_device, "%s/cts-holo-assets/%s", external_storage, cts_file_path); */
+            sprintf(storage_path_device, "%s", "/sdcard/1.txt");
+            D("sync: cts_file_path = %s\n", storage_path_device);
+            strcpy(name, storage_path_device);
+        }
+
         msg.req.namelen = 0;
         D("sync: '%s' '%s'\n", (char*) &msg.req, name);
发布了13 篇原创文章 · 获赞 13 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq410942197/article/details/49798813