From 95a6cfcfd99554ce6712c22fd5cb31f7adebf65f Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 4 Dec 2006 23:37:44 +0000 Subject: [PATCH] load ssleay32.dll relative to vmcontrollib.dll --- .../hyperic/sigar/vmware/VMwareObject.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/bindings/java/src/org/hyperic/sigar/vmware/VMwareObject.java b/bindings/java/src/org/hyperic/sigar/vmware/VMwareObject.java index 7332558a..3985809d 100644 --- a/bindings/java/src/org/hyperic/sigar/vmware/VMwareObject.java +++ b/bindings/java/src/org/hyperic/sigar/vmware/VMwareObject.java @@ -35,19 +35,7 @@ abstract class VMwareObject { }; private static boolean loadLibraries() { - if (SigarLoader.IS_LINUX) { - if (!new File("/etc/vmware/config").exists()) { - return false; - } - } - else if (SigarLoader.IS_WIN32) { - try { - System.loadLibrary("ssleay32"); - } catch (UnsatisfiedLinkError e) { - return false; - } - } - else { + if (!(SigarLoader.IS_LINUX || SigarLoader.IS_WIN32)) { return false; } @@ -55,6 +43,27 @@ abstract class VMwareObject { Sigar.load(); String lib = VMControlLibrary.getSharedLibrary(); + + if (lib == null) { + return false; + } + + if (SigarLoader.IS_WIN32) { + File libssl = + new File(new File(lib).getParent(), + "ssleay32.dll"); + if (!libssl.exists()) { + return false; + } + + try { + System.load(libssl.getPath()); + } catch (UnsatisfiedLinkError e) { + e.printStackTrace(); + return false; + } + } + return init(lib); } catch (Exception e) { //e.printStackTrace();