Skip to content

Commit

Permalink
* Take into account platform.library.path when extracting executabl…
Browse files Browse the repository at this point in the history
…es on `Loader.load()` (issue bytedeco/javacv#1410)
  • Loading branch information
saudet committed Apr 28, 2020
1 parent 8663b9f commit 7e7f33d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Take into account `platform.library.path` when extracting executables on `Loader.load()` ([issue bytedeco/javacv#1410](https://github.com/bytedeco/javacv/issues/1410))
* Move init code for `Loader.getPlatform()` to `Detector` to avoid warning messages ([issue #393](https://github.com/bytedeco/javacpp/issues/393))
* Add `Indexer.Index` nested class to allow overriding how the index is calculated ([issue #391](https://github.com/bytedeco/javacpp/issues/391))

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/bytedeco/javacpp/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1234,11 +1234,12 @@ public static String load(Class cls, Properties properties, boolean pathsFirst)
String prefix = p.getProperty("platform.executable.prefix", "");
String suffix = p.getProperty("platform.executable.suffix", "");
String filename = prefix + executable + suffix;
String libraryPath = p.getProperty("platform.library.path", "");
try {
for (int i = extensions.length - 1; i >= -1; i--) {
// iterate extensions in reverse to be consistent with the overriding of properties
String extension = i >= 0 ? extensions[i] : "";
String subdir = platform + (extension == null ? "" : extension) + "/";
String subdir = (libraryPath.length() > 0 ? "/" + libraryPath : platform + (extension == null ? "" : extension)) + "/";
File f = cacheResource(cls, subdir + filename);
if (f != null) {
f.setExecutable(true);
Expand Down

0 comments on commit 7e7f33d

Please sign in to comment.