Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/java/org/bridj/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
*/
public class Platform {

static final String osName = System.getProperty("os.name", "");
private static final String BRID_J_EXTRACTED_LIBRARIES = "BridJExtractedLibraries";
static final String osName = System.getProperty("os.name", "");
private static boolean inited;
static final String BridJLibraryName = "bridj";
public static final int POINTER_SIZE,
Expand Down Expand Up @@ -227,7 +228,7 @@ static void addTemporaryExtractedLibraryFileToDeleteOnExit(File file) throws IOE
}

try {
extractedLibrariesTempDir = createTempDir("BridJExtractedLibraries");
extractedLibrariesTempDir = createTempDir(BRID_J_EXTRACTED_LIBRARIES);
initLibrary();
} catch (Throwable th) {
th.printStackTrace();
Expand Down Expand Up @@ -690,6 +691,11 @@ static File extractEmbeddedLibraryResource(String name) throws IOException {
continue;
}
String fileName = new File(libraryResource).getName();

if (!extractedLibrariesTempDir.exists()) {
extractedLibrariesTempDir = createTempDir(BRID_J_EXTRACTED_LIBRARIES);
}

File libFile = new File(extractedLibrariesTempDir, fileName);
OutputStream out = new BufferedOutputStream(new FileOutputStream(libFile));
while ((len = in.read(b)) > 0) {
Expand Down