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:
Michael Bayne
2003-10-29 23:09:48 +00:00
parent 41ce70349b
commit 9672534004
3 changed files with 39 additions and 5 deletions
@@ -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;
@@ -870,7 +870,7 @@ public class ResourceManager
if (!suffix.startsWith(".")) {
suffix = "." + suffix;
}
int sidx = path.indexOf(suffix);
int sidx = path.lastIndexOf(suffix);
if (sidx == -1) {
Log.warning("Invalid unversioned path, missing suffix " +
"[path=" + path + ", suffix=" + suffix + "].");
@@ -879,6 +879,28 @@ public class ResourceManager
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
* the path references a file that ends in <code>.jar</code>.