Skip to content

Commit

Permalink
fix zip share
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Jun 9, 2016
1 parent 6430695 commit 217c727
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,6 @@ private void doSaveCommentZipShare() {
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + tmpZipFilePath));
intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "Tcpdump:" + mCaptureName);
intentShareFile.putExtra(Intent.EXTRA_TEXT, mLastComment);
startActivity(Intent.createChooser(intentShareFile, "Share Captured Data:" + mCaptureName));
startActivity(Intent.createChooser(intentShareFile, "Captured:" + mCaptureName));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,16 @@ static public boolean zip(String[] files, String zipFile) {
try {
out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
for (int i = 0; i < files.length; i++) {

File f = new File(files[i]);

//skip non-existing files
if(!f.exists())
continue;

FileInputStream fi = null;
try {
fi = new FileInputStream(files[i]);
fi = new FileInputStream(f);
BufferedInputStream origin = new BufferedInputStream(fi, BUFFER_SIZE);
ZipEntry entry = new ZipEntry(files[i].substring(files[i].lastIndexOf("/") + 1));
out.putNextEntry(entry);
Expand Down

0 comments on commit 217c727

Please sign in to comment.