diff --git a/src/java/com/threerings/resource/DownloadManager.java b/src/java/com/threerings/resource/DownloadManager.java index 6e71e2d3f..05aea8c89 100644 --- a/src/java/com/threerings/resource/DownloadManager.java +++ b/src/java/com/threerings/resource/DownloadManager.java @@ -1,5 +1,5 @@ // -// $Id: DownloadManager.java,v 1.1 2002/07/19 20:12:23 shaper Exp $ +// $Id: DownloadManager.java,v 1.2 2002/07/19 22:19:34 shaper Exp $ package com.threerings.resource; @@ -293,13 +293,24 @@ public class DownloadManager currentSize += read; int pctdone = (int)((currentSize / (float)totalSize) * 100f); complete = (pctdone >= 100); - obs.downloadProgress(pctdone); + // if we've finished downloading everything, hold off on + // notifying the observer until the streams are closed to + // ensure that any action the observer may take with respect + // to the downloaded files can be safely undertaken + if (!complete) { + obs.downloadProgress(pctdone); + } } // close the streams in.close(); out.close(); + if (complete) { + // let the observer know we're finished now that it's safe + obs.downloadProgress(100); + } + // if we have a last modified time, we want to adjust our cache // file accordingly if (desc.lastModified != 0) {