This commit is contained in:
vjurenka 2016-02-28 14:49:38 +01:00
commit e494ca89aa

View file

@ -74,14 +74,20 @@ 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);
FileOutputStream funnyStream = new FileOutputStream(dllNameExt); // prevents the creation of zero byte files
funnyStream.write(correctDllData); if (null != correctDllData) {
funnyStream.close(); FileOutputStream funnyStream = new FileOutputStream(dllNameExt);
funnyStream.write(correctDllData);
funnyStream.close();
}
} }
} }
} }