From 299dbd18312b7f16f2a51780a71e8eb51fed51d2 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 4 Dec 2006 21:57:35 +0000 Subject: [PATCH] ensure absolute path and add more helpers --- .../hyperic/sigar/vmware/VMControlLibrary.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/bindings/java/src/org/hyperic/sigar/vmware/VMControlLibrary.java b/bindings/java/src/org/hyperic/sigar/vmware/VMControlLibrary.java index ed646cc0..fe56b0a5 100644 --- a/bindings/java/src/org/hyperic/sigar/vmware/VMControlLibrary.java +++ b/bindings/java/src/org/hyperic/sigar/vmware/VMControlLibrary.java @@ -34,8 +34,10 @@ public class VMControlLibrary { private static final String VMCONTROL_TAR = getProperty("control.tar", VMWARE_LIB + "/perl/control.tar"); + private static final String VMCONTROL = "vmcontrol"; + private static final String VMCONTROL_OBJ = - getProperty("vmcontrol.o", "control-only/vmcontrol.o"); + getProperty("vmcontrol.o", "control-only/" + VMCONTROL + ".o"); private static final String GCC = getProperty("bin.gcc", "/usr/bin/gcc"); @@ -82,12 +84,18 @@ public class VMControlLibrary { System.setProperty(PROP_VMCONTROL_SHLIB, lib); } + public static void link() + throws IOException { + + link(VMCONTROL + ".so"); + } + public static void link(String name) throws IOException { - setSharedLibrary(name); + File out = new File(name).getAbsoluteFile(); + setSharedLibrary(out.getPath()); - File out = new File(name); if (out.exists()) { return; //already linked } @@ -128,6 +136,10 @@ public class VMControlLibrary { exec(link_args); } + public static boolean isLoaded() { + return VMwareObject.LOADED; + } + public static void main(String[] args) throws Exception { link(args[0]); }