Make sure the cache and .stamp paths are not versioned. Also ensure we
don't leave any unversioned bundles lying around after a conversion. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2847 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: JNLPDownloader.java,v 1.10 2003/10/29 22:31:55 mdb Exp $
|
// $Id: JNLPDownloader.java,v 1.11 2003/10/29 23:09:48 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.resource;
|
package com.threerings.resource;
|
||||||
|
|
||||||
@@ -195,6 +195,16 @@ public class JNLPDownloader extends Downloader
|
|||||||
if (!_patchFile.delete()) {
|
if (!_patchFile.delete()) {
|
||||||
Log.warning("Failed to delete patch file " + _curFile + ".");
|
Log.warning("Failed to delete patch file " + _curFile + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delete any old unversioned version of the .jar file
|
||||||
|
File unverDest = new File(ResourceManager.unversionPath(
|
||||||
|
_desc.destFile.getPath(), ".jar"));
|
||||||
|
if (unverDest.exists()) {
|
||||||
|
if (!unverDest.delete()) {
|
||||||
|
Log.warning("Failed to delete old unversioned bundle '" +
|
||||||
|
unverDest + "'.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintWriter pout = new PrintWriter(
|
PrintWriter pout = new PrintWriter(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ResourceBundle.java,v 1.24 2003/10/22 18:50:27 mdb Exp $
|
// $Id: ResourceBundle.java,v 1.25 2003/10/29 23:09:48 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.resource;
|
package com.threerings.resource;
|
||||||
|
|
||||||
@@ -50,7 +50,9 @@ public class ResourceBundle
|
|||||||
{
|
{
|
||||||
_source = source;
|
_source = source;
|
||||||
if (unpack) {
|
if (unpack) {
|
||||||
String root = stripSuffix(source.getPath());
|
String root = ResourceManager.unversionPath(
|
||||||
|
source.getPath(), ".jar");
|
||||||
|
root = stripSuffix(root);
|
||||||
_unpacked = new File(root + ".stamp");
|
_unpacked = new File(root + ".stamp");
|
||||||
_cache = new File(root);
|
_cache = new File(root);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ResourceManager.java,v 1.38 2003/10/29 22:31:55 mdb Exp $
|
// $Id: ResourceManager.java,v 1.39 2003/10/29 23:09:48 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.resource;
|
package com.threerings.resource;
|
||||||
|
|
||||||
@@ -870,7 +870,7 @@ public class ResourceManager
|
|||||||
if (!suffix.startsWith(".")) {
|
if (!suffix.startsWith(".")) {
|
||||||
suffix = "." + suffix;
|
suffix = "." + suffix;
|
||||||
}
|
}
|
||||||
int sidx = path.indexOf(suffix);
|
int sidx = path.lastIndexOf(suffix);
|
||||||
if (sidx == -1) {
|
if (sidx == -1) {
|
||||||
Log.warning("Invalid unversioned path, missing suffix " +
|
Log.warning("Invalid unversioned path, missing suffix " +
|
||||||
"[path=" + path + ", suffix=" + suffix + "].");
|
"[path=" + path + ", suffix=" + suffix + "].");
|
||||||
@@ -879,6 +879,28 @@ public class ResourceManager
|
|||||||
return path.substring(0, sidx) + "__V" + version + suffix;
|
return path.substring(0, sidx) + "__V" + version + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an unversioned version of the supplied path. If the path is
|
||||||
|
* not versioned, the existing path will be returned.
|
||||||
|
*/
|
||||||
|
public static String unversionPath (String path, String suffix)
|
||||||
|
{
|
||||||
|
if (!suffix.startsWith(".")) {
|
||||||
|
suffix = "." + suffix;
|
||||||
|
}
|
||||||
|
int vidx = path.indexOf("__V");
|
||||||
|
if (vidx == -1) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
int sidx = path.lastIndexOf(suffix);
|
||||||
|
if (sidx == -1) {
|
||||||
|
Log.warning("Invalid versioned path, missing suffix " +
|
||||||
|
"[path=" + path + ", suffix=" + suffix + "].");
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
return path.substring(0, vidx) + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the suffix of the specified path, ie. <code>.jar</code> if
|
* Returns the suffix of the specified path, ie. <code>.jar</code> if
|
||||||
* the path references a file that ends in <code>.jar</code>.
|
* the path references a file that ends in <code>.jar</code>.
|
||||||
|
|||||||
Reference in New Issue
Block a user