From d032218abf21f527f1e90c1085d347c09d2a2ded Mon Sep 17 00:00:00 2001 From: HongKee Moon Date: Thu, 26 Aug 2021 11:58:38 +0200 Subject: [PATCH] Fixed that windows has an issue for generating a jar file --- src/main/java/spim/plugin/compile/IOUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/spim/plugin/compile/IOUtils.java b/src/main/java/spim/plugin/compile/IOUtils.java index 9f528c4e..4f09103d 100644 --- a/src/main/java/spim/plugin/compile/IOUtils.java +++ b/src/main/java/spim/plugin/compile/IOUtils.java @@ -156,7 +156,7 @@ static void createJar(String inputDir, String output) throws IOException { Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); JarOutputStream target = new JarOutputStream(new FileOutputStream(output), manifest); - addFileJar(inputDir, new File(inputDir), target); + addFileJar(inputDir.replace("\\", "/"), new File(inputDir), target); target.close(); } @@ -167,7 +167,7 @@ private static void addFileJar(String root, File source, JarOutputStream target) { if (source.isDirectory()) { - String name = source.getPath().replace(root, "").replace("\\", "/"); + String name = source.getPath().replace("\\", "/").replace(root, ""); if (!name.isEmpty()) { if (!name.endsWith("/")) @@ -182,7 +182,7 @@ private static void addFileJar(String root, File source, JarOutputStream target) return; } - JarEntry entry = new JarEntry(source.getPath().replace(root, "").replace("\\", "/")); + JarEntry entry = new JarEntry(source.getPath().replace("\\", "/").replace(root, "")); entry.setTime(source.lastModified()); target.putNextEntry(entry); in = new BufferedInputStream(new FileInputStream(source));