From 2bdc5ef27f78886592fa559bd3948cb1ca7f849c Mon Sep 17 00:00:00 2001 From: Komposten Date: Mon, 15 Jul 2019 18:48:02 +0200 Subject: [PATCH 1/4] :bug: Remove preceding slash from mod files after browse Previously, if a mod file was selected by browsing it would have a preceding slash, making the path absolute on UNIX systems. --- src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java b/src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java index 8f4b157..8333fa0 100644 --- a/src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java +++ b/src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java @@ -304,6 +304,9 @@ private void setRelativePath(BrowseTextField browseField, File file, File relati if (isFileInDirectory(file, relativeTo, true)) { path = path.replace(relativeTo.getAbsolutePath(), ""); + + if (path.startsWith("/") || path.startsWith("\\")) + path = path.substring(1); } browseField.getTextfield().setText(path.replace('\\', '/')); From 5bd57b19be14aabae374e7206ca9ef221719e133 Mon Sep 17 00:00:00 2001 From: Komposten Date: Mon, 15 Jul 2019 18:57:52 +0200 Subject: [PATCH 2/4] :bug: Fix double slash in path of empty target path --- src/main/java/komposten/vivaldi/util/DirectoryUtils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/komposten/vivaldi/util/DirectoryUtils.java b/src/main/java/komposten/vivaldi/util/DirectoryUtils.java index 9fa8d3a..2aac848 100644 --- a/src/main/java/komposten/vivaldi/util/DirectoryUtils.java +++ b/src/main/java/komposten/vivaldi/util/DirectoryUtils.java @@ -19,6 +19,7 @@ package komposten.vivaldi.util; import java.io.File; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Objects; @@ -126,7 +127,12 @@ public static String assemblePath(String... elements) for (int i = 0; i < elements.length; i++) { String element = elements[i]; - if (i == 0 || !(elements[i-1].endsWith("/") || elements[i-1].endsWith("\\"))) + + if (element.isEmpty()) + { + continue; + } + else if (i == 0 || !(elements[i-1].endsWith("/") || elements[i-1].endsWith("\\"))) { if (element.startsWith("/") || element.startsWith("\\")) builder.append(element); From ae54782096e198463ce9583d7798f0c1cbed0726 Mon Sep 17 00:00:00 2001 From: Komposten Date: Mon, 15 Jul 2019 19:04:20 +0200 Subject: [PATCH 3/4] :bug: Fix broken target paths when creating an instruction for a mod folder --- src/main/java/komposten/vivaldi/ui/ModPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/komposten/vivaldi/ui/ModPanel.java b/src/main/java/komposten/vivaldi/ui/ModPanel.java index 26bdaad..cf9e330 100644 --- a/src/main/java/komposten/vivaldi/ui/ModPanel.java +++ b/src/main/java/komposten/vivaldi/ui/ModPanel.java @@ -295,7 +295,7 @@ private void addInstructions(File directory, File relativeTo, File modDir, if (child.isFile()) { String modFile = modDir.toPath().relativize(child.toPath()).toString(); - String target = relativeTo.toPath().relativize(child.toPath()).toString(); + String target = relativeTo.toPath().relativize(directory.toPath()).toString(); if (!onlyFolderContent) target = DirectoryUtils.assemblePath(targetDir, relativeTo.getName(), target); From 8364b0c88364050bfc8e80871ea289dba57bfe98 Mon Sep 17 00:00:00 2001 From: Komposten Date: Mon, 15 Jul 2019 19:06:28 +0200 Subject: [PATCH 4/4] :bookmark: Release v1.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e835e6..d19561f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 komposten.vivaldi VivaldiModder - 1.0.0 + 1.0.1 jar