From 708752efa5f452669828a544e0eb3d9bce9c2bd2 Mon Sep 17 00:00:00 2001 From: Aleksey Dergunov Date: Tue, 12 May 2015 20:01:48 +0400 Subject: [PATCH] Fix FileNotFoundException while writing the library file --- src/main/java/org/xerial/snappy/SnappyLoader.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/xerial/snappy/SnappyLoader.java b/src/main/java/org/xerial/snappy/SnappyLoader.java index 854bb1c..a497010 100755 --- a/src/main/java/org/xerial/snappy/SnappyLoader.java +++ b/src/main/java/org/xerial/snappy/SnappyLoader.java @@ -300,11 +300,13 @@ public class SnappyLoader } // Temporary folder for the native lib. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir - String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR, - System.getProperty("java.io.tmpdir"))).getAbsolutePath(); + File tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR, System.getProperty("java.io.tmpdir"))); + if (!tempFolder.exists()) { + tempFolder.mkdir(); + } // Extract and load a native library inside the jar file - return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder); + return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder.getAbsolutePath()); }