1 package net.sourceforge.phpdt.internal.launching;
4 import java.io.IOException;
6 import org.eclipse.core.runtime.IPath;
8 public class PHPInterpreter {
9 //public final String endOfOptionsDelimeter = " -- ";
11 protected IPath installLocation;
12 protected String name;
14 public PHPInterpreter(String aName, IPath validInstallLocation) {
16 installLocation = validInstallLocation;
19 public IPath getInstallLocation() {
20 return installLocation;
23 public void setInstallLocation(IPath validInstallLocation) {
24 installLocation = validInstallLocation;
27 public String getName() {
31 public void setName(String newName) {
35 public String getCommand() {
36 String directory = installLocation.toOSString() + File.separator;
37 if (new File(directory + "php.exe").isFile())
38 return directory + "php.exe";
40 if (new File(directory, "php").isFile())
41 return directory + "php";
46 public Process exec(String arguments, File workingDirectory, String[] env) throws IOException {
47 return Runtime.getRuntime().exec(this.getCommand() + " " + arguments, env, workingDirectory);
50 public boolean equals(Object other) {
51 if (other instanceof PHPInterpreter) {
52 PHPInterpreter otherInterpreter = (PHPInterpreter) other;
53 if (name.equals(otherInterpreter.getName()))
54 return installLocation.equals(otherInterpreter.getInstallLocation());