Windows friendly path handling (hopefully)
import com.google.common.io.RecursiveDeleteOption;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.util.Map;
final class DeleteFromZip {
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) throws IOException, URISyntaxException {
if (args.length < 2) {
throw new RuntimeException("usage: [zip file] [paths to delete...]");
}
@@ -22,7 +23,8 @@ public static void main(String[] args) throws IOException {
properties.put("create", "false");
Path zip = Paths.get(args[0]).toAbsolutePath();
- URI uri = URI.create("jar:file:" + zip);
+ URI uri = new URI("jar", zip.toUri().toString(), null);
+ // URI uri = URI.create("jar:file:" + zip);
try (FileSystem zipfs = FileSystems.newFileSystem(uri, properties)) {
System.out.println("Opened " + args[0]);
for (int i = 1; i < args.length; i++) {
