X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=ide%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FDeployedSlcSystem.java;fp=ide%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FDeployedSlcSystem.java;h=89924322aec5dc521169bf4ccbfb0a4ab97c211e;hb=3c660e05ee3da1cc7a1be77e05697d5de6d25b5e;hp=0000000000000000000000000000000000000000;hpb=10c5a7040f86f45ee6f710acd8490cc87f38b9f8;p=gpl%2Fargeo-slc.git diff --git a/ide/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/DeployedSlcSystem.java b/ide/plugins/org.argeo.slc.ide.ui/src/main/java/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/main/java/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"; + } + +}