Skip to content

Commit

Permalink
Fixed that windows has an issue for generating a jar file
Browse files Browse the repository at this point in the history
  • Loading branch information
HongKee Moon committed Jun 17, 2022
1 parent e797fc3 commit fbe3b98
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/spim/plugin/compile/IOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.replace("\\", "/"), new File(inputDir), target);
addFileJar(inputDir, new File(inputDir), target);
target.close();
}

Expand All @@ -167,8 +167,7 @@ private static void addFileJar(String root, File source, JarOutputStream target)
{
if (source.isDirectory())
{
System.out.println(root);
String name = source.getPath().replace("\\", "/").replace(root, "");
String name = source.getPath().replace(root, "").replace("\\", "/");
if (!name.isEmpty())
{
if (!name.endsWith("/"))
Expand All @@ -183,7 +182,7 @@ private static void addFileJar(String root, File source, JarOutputStream target)
return;
}

JarEntry entry = new JarEntry(source.getPath().replace("\\", "/").replace(root, ""));
JarEntry entry = new JarEntry(source.getPath().replace(root, "").replace("\\", "/"));
entry.setTime(source.lastModified());
target.putNextEntry(entry);
in = new BufferedInputStream(new FileInputStream(source));
Expand Down

0 comments on commit fbe3b98

Please sign in to comment.