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

来源:互联网 发布:python高级编程视频 编辑:程序博客网 时间:2024/05/22 11:56
#强制修改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);
0 0
原创粉丝点击