Skip to content

Commit

Permalink
Update JuiceFileSystemImpl.java
Browse files Browse the repository at this point in the history
on Windows platform, Files.isDirectory(Paths.get(jarPath)) will get InvalidPathException like java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Program Files/xxx,change to use Paths.get(location.toURI())
  • Loading branch information
Ming Li authored Jul 17, 2023
1 parent edb40b8 commit 590a427
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,13 @@ public static Libjfs loadLibrary() throws IOException {
soTime = entry.getLastModifiedTime().toMillis();
ins = jfsJar.getInputStream(entry);
} else {
String jarPath = URLDecoder.decode(location.getPath(), Charset.defaultCharset().name());
if (Files.isDirectory(Paths.get(jarPath))) { // for debug: sdk/java/target/classes
if (Files.isDirectory(Paths.get(location.toURI()))) { // for debug: sdk/java/target/classes
soTime = con.getLastModified();
ins = JuiceFileSystemImpl.class.getClassLoader().getResourceAsStream(resource);
} else {
JarFile jfsJar;
try {
jfsJar = new JarFile(jarPath);
jfsJar = new JarFile(location.toURI().getPath());
} catch (FileNotFoundException fne) {
return loadExistLib(libjfsLibraryLoader, dir, name, libFile);
}
Expand Down

0 comments on commit 590a427

Please sign in to comment.