Skip to content

Commit

Permalink
chore(bindings/java): simplify library path resolution (#3196)
Browse files Browse the repository at this point in the history
  • Loading branch information
tisonkun authored Sep 27, 2023
1 parent 9315df4 commit 30f1492
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions bindings/java/src/main/java/org/apache/opendal/NativeObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,9 @@ private static void doLoadBundledLibrary() throws IOException {
}

private static String bundledLibraryPath() {
final String os = System.getProperty("os.name").toLowerCase();
final StringBuilder path = new StringBuilder("/native/" + Environment.getClassifier() + "/");
if (!os.startsWith("windows")) {
path.append("lib");
}
path.append("opendal_java");
if (os.startsWith("windows")) {
path.append(".dll");
} else if (os.startsWith("mac")) {
path.append(".dylib");
} else {
path.append(".so");
}
return path.toString();
final String classifier = Environment.getClassifier();
final String libraryName = System.mapLibraryName("opendal_java");
return "/native/" + classifier + "/" + libraryName;
}

/**
Expand Down

0 comments on commit 30f1492

Please sign in to comment.