X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.ui.launch%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fui%2Flaunch%2FDeployedSlcRuntime.java;fp=eclipse%2Fplugins%2Forg.argeo.slc.ui.launch%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fui%2Flaunch%2FDeployedSlcRuntime.java;h=e6691baf811f179b8a498c8eed8c7e42b092b93b;hb=5c3611122fcc51cf6635f7110081a80393fb3c18;hp=0000000000000000000000000000000000000000;hpb=eddb39b8428437560eca49166c29cda2f8c264a4;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java new file mode 100644 index 000000000..e6691baf8 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java @@ -0,0 +1,53 @@ +package org.argeo.slc.ui.launch; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; + +public class DeployedSlcRuntime implements SlcRuntime { + private File baseDir; + private String relLibDir = "lib"; + + public DeployedSlcRuntime(String baseDirPath) { + try { + this.baseDir = new File(baseDirPath).getCanonicalFile(); + } catch (IOException e) { + throw new RuntimeException("Cannot get path for " + baseDirPath, e); + } + } + + @Override + public String[] getClasspath() throws CoreException { + List classpath = new Vector(); + File libDir = new File(baseDir.getPath() + File.separator + relLibDir); + File[] files = libDir.listFiles(); + for (File file : files) { + try { + classpath.add(file.getCanonicalPath()); + } catch (IOException e) { + throw new RuntimeException("Cannot get path for " + file, e); + } + } + return classpath.toArray(new String[classpath.size()]); + } + + @Override + public IVMInstall getVmInstall() throws CoreException { + return JavaRuntime.getDefaultVMInstall(); + } + + public String getAntHome() { + return baseDir.getPath(); + } + + @Override + public String getJavaLibraryPath() { + return baseDir.getPath() + File.separator + "bin"; + } + +}