Make sure we have a version and also do our matching without a regular
expression because Windows \s in paths booch the regex code to the high heavens. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2922 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: JNLPDownloader.java,v 1.14 2003/12/15 20:04:09 mdb Exp $
|
// $Id: JNLPDownloader.java,v 1.15 2003/12/18 18:32:34 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.resource;
|
package com.threerings.resource;
|
||||||
|
|
||||||
@@ -189,15 +189,21 @@ public class JNLPDownloader extends Downloader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attempt to delete any old stale bundles as well
|
// attempt to delete any old stale bundles as well
|
||||||
try {
|
if (_desc.version != null) {
|
||||||
String pathex = StringUtil.replace(
|
try {
|
||||||
_desc.destFile.getPath(), _desc.version, "\\d+.\\d+");
|
String cpath = _desc.destFile.getPath();
|
||||||
String cpath = _desc.destFile.getPath();
|
String pcpath = ResourceManager.unversionPath(cpath, ".jar");
|
||||||
File pdir = _desc.destFile.getParentFile();
|
File pdir = _desc.destFile.getParentFile();
|
||||||
File[] files = pdir.listFiles();
|
File[] files = pdir.listFiles();
|
||||||
for (int ii = 0; ii < files.length; ii++) {
|
for (int ii = 0; ii < files.length; ii++) {
|
||||||
String path = files[ii].getPath();
|
String path = files[ii].getPath();
|
||||||
if (!path.equals(cpath) && path.matches(pathex)) {
|
if (path.equals(cpath) || !path.endsWith(".jar")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String ppath = ResourceManager.unversionPath(path, ".jar");
|
||||||
|
if (!pcpath.equals(ppath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!files[ii].delete()) {
|
if (!files[ii].delete()) {
|
||||||
Log.warning("Unable to delete stale bundle '" +
|
Log.warning("Unable to delete stale bundle '" +
|
||||||
files[ii].getPath() + "'.");
|
files[ii].getPath() + "'.");
|
||||||
@@ -205,10 +211,10 @@ public class JNLPDownloader extends Downloader
|
|||||||
Log.info("Deleted stale bundle '" + files[ii] + "'.");
|
Log.info("Deleted stale bundle '" + files[ii] + "'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning("Failure deleting stale bundles.");
|
||||||
|
Log.logStackTrace(e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Log.warning("Failure deleting stale bundles.");
|
|
||||||
Log.logStackTrace(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintWriter pout = new PrintWriter(
|
PrintWriter pout = new PrintWriter(
|
||||||
|
|||||||
Reference in New Issue
Block a user