Skip to content

Commit

Permalink
* Allow Builder to create links for resource libraries even when n…
Browse files Browse the repository at this point in the history
…o Java classes are built

 * Fix `Loader.cacheResource()` creating a subdirectory named "null" when caching a top-level file
  • Loading branch information
saudet committed Aug 17, 2018
1 parent 1ec41b6 commit 00cd483
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

* Allow `Builder` to create links for resource libraries even when no Java classes are built
* Fix `Loader.cacheResource()` creating a subdirectory named "null" when caching a top-level file
* Update `README.md` with reference to newly published [Mapping Recipes for C/C++ Libraries](https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes)
* Make `Parser` strip annotations from setter methods for basic containers to satisfy the `Generator`
* Have `Parser` wrap the `insert()` and `erase()` methods of basic containers to allow modifying lists and sets
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/bytedeco/javacpp/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ public static File cacheResource(URL resourceURL, String target) throws IOExcept
size = jarEntry.getSize();
timestamp = jarEntry.getTime();
if (!noSubdir) {
cacheSubdir = new File(cacheSubdir, jarFileFile.getName() + File.separator + jarEntryFile.getParent());
String subdirName = jarFileFile.getName();
String parentName = jarEntryFile.getParent();
if (parentName != null) {
subdirName = subdirName + File.separator + parentName;
}
cacheSubdir = new File(cacheSubdir, subdirName);
}
} else {
size = urlFile.length();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/bytedeco/javacpp/tools/Builder.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@ public File[] build() throws IOException, InterruptedException, ParserException
libs.addAll(libProperties.get("platform.preload"));
libs.addAll(libProperties.get("platform.link"));
}
if (libProperties == null) {
libProperties = new ClassProperties(properties);
}

// Extract the required resources.
for (String s : resources.split(separator)) {
Expand All @@ -864,7 +867,7 @@ public File[] build() throws IOException, InterruptedException, ParserException
}
}
File[] files = f.listFiles();
if (files != null && libProperties != null) {
if (files != null) {
for (File file : files) {
Loader.createLibraryLink(file.getAbsolutePath(), libProperties, null,
linkPaths.toArray(new String[linkPaths.size()]));
Expand Down

0 comments on commit 00cd483

Please sign in to comment.