     tmp_file_name = path.join f_name, path.basename(path.dirname tmp_file), tmp_file_name
     console.log tmp_file_name
     zip.addFile(tmp_file_name, tmp_file)
-  if sync_flag
-    union_package_pkgs.push(re_pa)
-    zip.saveAs(re_pa, () ->
-      union_package_index-=1
-      #  console.log union_package_index
-      if union_package_index is 0
-        common_zip(union_package_pkgs, emp.ADAPTER_UNION_PACKAGE_NAME)
-      console.log "zip written."
+  zip.saveAs(re_pa, () ->
+    union_package_index-=1
+    if union_package_index is 0
+      emp.show_info emp.EMP_PACKAGE_PKG_SUCCESS
+    console.log "zip written."
+    )
+  re_pa
+
+create_adapter_buffer = (re_arr) ->
+  # console.log "create adapter zip :#{package_type}"
+  # console.log re_arr
+  if re_arr.length
+    tmp_obj = re_arr.pop()
+    package_type = tmp_obj.k
+    file_list = tmp_obj.v
+
+    package_type.split("/").join(".")
+    f_name = emp.ADAPTER_UNION_PACKAGE_CHEAD+([emp.ADAPTER_PACKAGE_HEAD].concat package_type.split("/")).join(".")
+    fe_name = f_name + ".zip"
+    re_pa = path.join tmp_path, fe_name
+    zip = new ZipWriter()
+    for tmp_file in file_list
+      tmp_file_name = path.basename tmp_file
+      tmp_file_name = path.join f_name, path.basename(path.dirname tmp_file), tmp_file_name
+      # console.log tmp_file_name
+      zip.addFile(tmp_file_name, tmp_file)
+
+    # union_package_pkgs.push(re_pa)
+    zip.toBuffer((tmp_buf) ->
+        console.log re_pa
+        # console.log tmp_buf
+        # console.log union_package_pkgs
+        union_package_pkgs.push({name:re_pa, buf:tmp_buf})
+        create_adapter_buffer(re_arr)
+        # console.log union_package_pkgs
       )
   else
-    zip.saveAs(re_pa, () ->
-      union_package_index-=1
-      if union_package_index is 0
-        emp.show_info emp.EMP_PACKAGE_PKG_SUCCESS
-      console.log "zip written."
-      )
-  re_pa
-
+    only_flag = true
+    common_zip(union_package_pkgs, emp.ADAPTER_UNION_PACKAGE_NAME)
+  # console.log "--------"
+  # zip.saveAs(re_pa, () ->
+  #   union_package_index-=1
+  #   #  console.log union_package_index
+  #   if union_package_index is 0
+  #     common_zip(union_package_pkgs, emp.ADAPTER_UNION_PACKAGE_NAME)
+  #   console.log "zip written."
+  #   )
+
+  # re_pa
 
 common_zip = (file_list, zip_name = emp.DEFAULT_ZIP_FULE_NAME) ->
+  # console.log file_list
   project_path = atom.project.getPath()
   tmp_path = path.join project_path, "tmp"
   re_pa = path.join tmp_path, zip_name
 
   zip = new ZipWriter()
-  for tmp_file in file_list
-    tmp_file_name = path.basename tmp_file
+  for tmp_obj in file_list
+    tmp_file_name = path.basename tmp_obj.name
     # tmp_dir_name = path.dirname tmp_file
     # tmp_file_name = path.join path.basename(path.dirname tmp_file), tmp_file_name
-    zip.addFile(tmp_file_name, tmp_file)
-  zip.toBuffer((buf) ->
-    )
+    zip.addData(tmp_file_name, tmp_obj.buf)
+  # zip.toBuffer((buf) ->
+  #   )
 
   zip.saveAs(re_pa, () ->
      console.log "zip written."

    gather_common_files(offline_path)

  #  打普通资源整合包，即把普通资源报再压缩为一个压缩包
  do_union_package: ->
    project_path = atom.project.getPath()
    offline_path = path.join project_path, tmp_offline_path




create_adapter_zip = (package_type, file_list) ->
  # console.log "create adapter zip :#{package_type}"
  project_path = atom.project.getPath()

