Community
Participate
Working Groups
See bug 265524, we can use a zip as a repo if we use a jar uri that looks like jar:file:/C:/zipped/zipped.repo.zip!/ We should make a common utility method for building these URIs as there are likely many places we will want to be able to read them. The implementation for bug 265524 does it by taking an existing URI: URI uri = file.toURI(); if (file.isFile() && file.getName().endsWith(".zip")) { try { uri = new URI("jar:" + uri.toString() + "!/"); } catch (URISyntaxException e) { //problem } }
Done. To make it more useful, the form of the method is toJarURI(URI,IPath), where the IPath specifies an entry in the jar file. If the path is null it returns the URI of the jar itself. To catch all the cases, the implementation ended up being more complex than the current code in PDE and UI. Susan and Andrew, be sure to switch over to using this method rather than assembling the URI yourself.