diff --git a/src/main/java/org/bridj/Platform.java b/src/main/java/org/bridj/Platform.java index 16ad0a6d..eddb3f5b 100644 --- a/src/main/java/org/bridj/Platform.java +++ b/src/main/java/org/bridj/Platform.java @@ -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, @@ -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(); @@ -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) {