diff options
author | Julieng50 <g50.julien@gmail.com> | 2017-12-17 02:25:12 +0100 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2017-12-17 03:25:12 +0200 |
commit | f426f98db3e405306ae221c04bde361a12429679 (patch) | |
tree | 8a9871dcf67097874604b952c4f8c6f80dc00b6e /pf4j | |
parent | b7a858835f8f06cee8d00b2faacb12e94c2172a2 (diff) | |
download | pf4j-f426f98db3e405306ae221c04bde361a12429679.tar.gz pf4j-f426f98db3e405306ae221c04bde361a12429679.zip |
#185 : fix missing slash for jar file on Windows while creating new file system (#186)
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/main/java/org/pf4j/util/FileUtils.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java index e3e8959..0c54e0a 100644 --- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java @@ -43,6 +43,7 @@ import java.util.List; */ public class FileUtils { + private static final String SLASH = "/"; private static final Logger log = LoggerFactory.getLogger(FileUtils.class); public static List<String> readLines(Path path, boolean ignoreComments) throws IOException { @@ -216,7 +217,11 @@ public class FileUtils { public static Path getPath(Path path, String first, String... more) throws IOException { URI uri = path.toUri(); if (isJarFile(path)) { - uri = URI.create("jar:file:" + path.toString().replace("\\", "/")); + String pathString = path.toString().replace("\\", SLASH); + if(!pathString.startsWith(SLASH)){ + pathString = SLASH + pathString; + } + uri = URI.create("jar:file:" + pathString); } return getPath(uri, first, more); |