Merge branch 'master' of https://github.com/vjurenka/BWMirror-Generator
This commit is contained in:
commit
e494ca89aa
|
@ -74,17 +74,23 @@ public class Mirror {
|
||||||
String path = Mirror.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
String path = Mirror.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
||||||
String decodedPath = java.net.URLDecoder.decode(path, "UTF-8");
|
String decodedPath = java.net.URLDecoder.decode(path, "UTF-8");
|
||||||
|
|
||||||
|
JarResources jar = null;
|
||||||
for (String dllName : dllNames) {
|
for (String dllName : dllNames) {
|
||||||
String dllNameExt = dllName + ".dll";
|
String dllNameExt = dllName + ".dll";
|
||||||
if (!new File(dllNameExt).exists()) {
|
if (!new File(dllNameExt).exists()) {
|
||||||
JarResources jar = new JarResources(path);
|
if (null == jar) {
|
||||||
|
jar = new JarResources(decodedPath);
|
||||||
|
}
|
||||||
byte[] correctDllData = jar.getResource(dllNameExt);
|
byte[] correctDllData = jar.getResource(dllNameExt);
|
||||||
|
// prevents the creation of zero byte files
|
||||||
|
if (null != correctDllData) {
|
||||||
FileOutputStream funnyStream = new FileOutputStream(dllNameExt);
|
FileOutputStream funnyStream = new FileOutputStream(dllNameExt);
|
||||||
funnyStream.write(correctDllData);
|
funnyStream.write(correctDllData);
|
||||||
funnyStream.close();
|
funnyStream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Failed to extract native libraries.\n" + e);
|
System.err.println("Failed to extract native libraries.\n" + e);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue