Skip to content

Commit

Permalink
Clean up files that have been removed from the local file system
Browse files Browse the repository at this point in the history
  • Loading branch information
melonmanchan committed Apr 26, 2016
1 parent 4d065cb commit 17628d9
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ protected Video readVideoFromFile(File file) throws IOException {
File sanityCheckFile = new File(videoUri.getPath());

if (!sanityCheckFile.exists()) {

// Also remove thumb file;
File thumbFile = new File(video.getThumbUri().getPath());
File videoFile = getLocalVideoFile(video.getId());

thumbFile.delete();
videoFile.delete();
allVideos.remove(video.getId());
bus.post(new VideoRepositoryUpdatedEvent(this));

throw new IOException("Local video file not found at " + videoUri);
}
}
Expand Down

0 comments on commit 17628d9

Please sign in to comment.