Break the patching out into a separate phase, clean up the diff and old
jar files when we're done patching. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2741 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: JNLPDownloader.java,v 1.2 2003/08/05 06:54:01 mdb Exp $
|
||||
// $Id: JNLPDownloader.java,v 1.3 2003/08/05 07:03:34 mdb Exp $
|
||||
|
||||
package com.threerings.resource;
|
||||
|
||||
@@ -89,9 +89,7 @@ public class JNLPDownloader extends Downloader
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a single download descriptor.
|
||||
*/
|
||||
// documentation inherited
|
||||
public void processDownload (DownloadManager dmgr, DownloadObserver obs,
|
||||
ProgressInfo pinfo, byte[] buffer)
|
||||
throws IOException
|
||||
@@ -115,6 +113,18 @@ public class JNLPDownloader extends Downloader
|
||||
_patchFile = new File(mungePath(_desc.destFile, ".diff"));
|
||||
downloadContent(dmgr, obs, pinfo, buffer, ucon, _patchFile);
|
||||
|
||||
} else {
|
||||
Log.info("Downloading whole jar [url=" + rsrcURL + "].");
|
||||
downloadContent(dmgr, obs, pinfo, buffer, ucon, _desc.destFile);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void postDownload (DownloadManager dmgr, DownloadObserver obs,
|
||||
ProgressInfo pinfo)
|
||||
throws IOException
|
||||
{
|
||||
if (_patchFile != null) {
|
||||
// move the old jar out of the way
|
||||
File oldDest = new File(_desc.destFile.getPath() + ".old");
|
||||
if (!_desc.destFile.renameTo(oldDest)) {
|
||||
@@ -150,12 +160,11 @@ public class JNLPDownloader extends Downloader
|
||||
cleanUpAndFail(ioe);
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.info("Downloading whole jar [url=" + rsrcURL + "].");
|
||||
downloadContent(dmgr, obs, pinfo, buffer, ucon, _desc.destFile);
|
||||
// clean up the old jar and the patch file
|
||||
oldDest.delete();
|
||||
_patchFile.delete();
|
||||
}
|
||||
|
||||
// now that we've patched, update our version file
|
||||
PrintWriter pout = new PrintWriter(
|
||||
new BufferedWriter(new FileWriter(_vfile)));
|
||||
pout.println(_desc.version);
|
||||
|
||||
Reference in New Issue
Block a user