Permalink
Browse files

Fix library load failures on Windows caused by conflicts with existin…

…g extracted temporary files
  • Loading branch information...
1 parent dbd03d8 commit ad87e7bcdbb60991ff5a38b7c13e545c24ba9448 @cgutman cgutman committed May 22, 2016
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/com/limelight/binding/LibraryHelper.java
@@ -9,6 +9,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
+import java.util.UUID;
public class LibraryHelper {
private static final HashSet<String> avcDependencies = new HashSet<String>();
@@ -19,7 +20,7 @@
static {
needsDependencyExtraction = System.getProperty("os.name").contains("Windows");
- libraryExtractionFolder = System.getProperty("java.io.tmpdir", ".");
+ libraryExtractionFolder = System.getProperty("java.io.tmpdir", ".") + File.separatorChar + UUID.randomUUID().toString();
// AVC dependencies
if (System.getProperty("os.name").contains("Windows")) {
@@ -47,16 +48,19 @@ public static void loadNativeLibrary(String libraryName) {
}
public static void prepareNativeLibraries() {
- if (!needsDependencyExtraction) {
+ if (!needsDependencyExtraction || !isRunningFromJar()) {
return;
}
+ // Create the native library folder
+ new File(libraryExtractionFolder).mkdirs();
+
try {
for (String dependency : avcDependencies) {
extractNativeLibrary(dependency);
}
} catch (IOException e) {
- // This is expected if this code is not running from a JAR
+ e.printStackTrace();
return;
}

0 comments on commit ad87e7b

Please sign in to comment.