Try another strategy if we fail to remain our original file.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2845 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: JNLPDownloader.java,v 1.8 2003/08/20 03:53:35 mdb Exp $
|
||||
// $Id: JNLPDownloader.java,v 1.9 2003/10/29 02:42:56 mdb Exp $
|
||||
|
||||
package com.threerings.resource;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.sun.javaws.jardiff.JarDiffPatcher;
|
||||
import com.samskivert.io.StreamUtil;
|
||||
import com.samskivert.util.FileUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.threerings.util.RandomUtil;
|
||||
|
||||
import com.threerings.resource.DownloadManager.DownloadDescriptor;
|
||||
import com.threerings.resource.DownloadManager.DownloadObserver;
|
||||
@@ -125,10 +126,16 @@ public class JNLPDownloader extends Downloader
|
||||
FileUtil.resuffix(_desc.destFile, ".jar", ".old"));
|
||||
if (!_desc.destFile.renameTo(oldDest)) {
|
||||
Log.warning("Unable to move " + _desc.destFile + " to " +
|
||||
oldDest + ". Cleaning up and failing.");
|
||||
// attempt to blow everything away before choking so that
|
||||
// next time we'll download afresh
|
||||
cleanUpAndFail(null);
|
||||
oldDest + ". Trying another strategy.");
|
||||
oldDest = new File(_desc.destFile,
|
||||
RandomUtil.rand.nextLong() + ".jar");
|
||||
if (!_desc.destFile.renameTo(oldDest)) {
|
||||
Log.warning("Unable to move " + _desc.destFile + " to " +
|
||||
oldDest + ". Giving up and wiping.");
|
||||
// attempt to blow everything away before choking so that
|
||||
// next time we'll download afresh
|
||||
cleanUpAndFail(null);
|
||||
}
|
||||
}
|
||||
|
||||
// now apply the patch
|
||||
|
||||
Reference in New Issue
Block a user