Skip to content
Snippets Groups Projects
Commit 0abc64ea authored by loki der quaeler's avatar loki der quaeler Committed by loki der quaeler
Browse files

Absolute paths on Windows not working #424

. Corrected a bug in which TLAFile creation featuring a fully qualified path was ending up incorrectly formed.

[Bug][Tools]
parent 57603d93
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package util; package util;
import java.io.File; import java.io.File;
import java.util.regex.Pattern;
/** /**
...@@ -24,7 +25,13 @@ public interface FilenameToStream ...@@ -24,7 +25,13 @@ public interface FilenameToStream
* SimpleFilenameToStream). Thus, capture this information at module load * SimpleFilenameToStream). Thus, capture this information at module load
* time when it is known where a module was loaded from. * time when it is known where a module was loaded from.
*/ */
@SuppressWarnings("serial")
public static class TLAFile extends File { public static class TLAFile extends File {
private static final String ROOT_PATH_REGEX
= "^([A-Z]+:)?" + ((File.separatorChar == '\\') ? "\\\\" : File.separator);
private static final Pattern ROOT_PATH_PATTERN = Pattern.compile(ROOT_PATH_REGEX);
private final boolean isLibraryModule; private final boolean isLibraryModule;
private transient final FilenameToStream resolver; private transient final FilenameToStream resolver;
...@@ -39,7 +46,10 @@ public interface FilenameToStream ...@@ -39,7 +46,10 @@ public interface FilenameToStream
} }
public TLAFile(String parent, String child, FilenameToStream fts) { public TLAFile(String parent, String child, FilenameToStream fts) {
super(parent, child); super(parent,
((ROOT_PATH_PATTERN.matcher(parent).find() && child.startsWith(parent))
? child.substring(parent.length())
: child));
this.isLibraryModule = false; this.isLibraryModule = false;
this.resolver = fts; this.resolver = fts;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment