Skip to content

Commit

Permalink
Make sure the files are deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Jun 28, 2018
1 parent c29db5b commit 61a1a72
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -123,7 +124,6 @@ public void load()
List<DataObject> objects = new ArrayList<DataObject>();
objects.add(image);
f = new File(folderPath);
f.deleteOnExit();
handle = mhView.loadArchivedImage(ctx, objects, f, false, false,
false, this);
} else {
Expand Down Expand Up @@ -182,6 +182,10 @@ public void handleResult(Object result)
Map<Boolean, List<File>> r = (Map<Boolean, List<File>>) result;
List<File> files = r.get(true);
if (files.size() > 0) {
Iterator<File> i = files.iterator();
while (i.hasNext()) {
i.next().deleteOnExit();
}
activity.endActivity(files.get(0));
} else {
onException(MESSAGE_RESULT, null);
Expand Down

0 comments on commit 61a1a72

Please sign in to comment.