Skip to content

Commit

Permalink
🔀 Merge pull request #21 from Komposten/release-1.0.1
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
Komposten authored Jul 15, 2019
2 parents 766678c + 8364b0c commit 241bc6a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>komposten.vivaldi</groupId>
<artifactId>VivaldiModder</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>

<properties>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/komposten/vivaldi/ui/EditInstructionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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('\\', '/'));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/komposten/vivaldi/ui/ModPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/komposten/vivaldi/util/DirectoryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 241bc6a

Please sign in to comment.