X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=ide%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FDeployedSlcSystem.java;fp=ide%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FDeployedSlcSystem.java;h=89924322aec5dc521169bf4ccbfb0a4ab97c211e;hb=7409ec088a237fc17606f1b4282742a641bf6092;hp=0000000000000000000000000000000000000000;hpb=c922ecc7edc7cba00e2fa90f1f05f0b2cf5d4938;p=gpl%2Fargeo-slc.git diff --git a/ide/plugins/org.argeo.slc.ide.ui/src/org/argeo/slc/ide/ui/DeployedSlcSystem.java b/ide/plugins/org.argeo.slc.ide.ui/src/org/argeo/slc/ide/ui/DeployedSlcSystem.java new file mode 100644 index 000000000..89924322a --- /dev/null +++ b/ide/plugins/org.argeo.slc.ide.ui/src/org/argeo/slc/ide/ui/DeployedSlcSystem.java @@ -0,0 +1,50 @@ +package org.argeo.slc.ide.ui; + +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 DeployedSlcSystem implements SlcSystem { + private File baseDir; + private String relLibDir = "lib"; + + public DeployedSlcSystem(String baseDirPath) { + try { + this.baseDir = new File(baseDirPath).getCanonicalFile(); + } catch (IOException e) { + throw new RuntimeException("Cannot get path for " + baseDirPath, e); + } + } + + 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()]); + } + + public IVMInstall getVmInstall() throws CoreException { + return JavaRuntime.getDefaultVMInstall(); + } + + public String getAntHome() { + return baseDir.getPath(); + } + + public String getJavaLibraryPath() { + return baseDir.getPath() + File.separator + "bin"; + } + +}