1 package net.sourceforge.phpdt.internal.launching;
4 import java.io.IOException;
6 import org.eclipse.core.internal.resources.OS;
7 import org.eclipse.core.runtime.IPath;
9 public class PHPInterpreter {
10 //public final String endOfOptionsDelimeter = " -- ";
12 protected IPath installLocation;
13 protected String name;
15 public PHPInterpreter(String aName, IPath validInstallLocation) {
17 installLocation = validInstallLocation;
20 public IPath getInstallLocation() {
21 return installLocation;
24 public void setInstallLocation(IPath validInstallLocation) {
25 installLocation = validInstallLocation;
28 public String getName() {
32 public void setName(String newName) {
36 public String getCommand() {
37 String directory = installLocation.toOSString() + File.separator;
38 if (new File(directory + "php.exe").isFile())
39 return directory + "php.exe";
41 if (new File(directory, "php").isFile())
42 return directory + "php";
47 public Process exec(String arguments, File workingDirectory) throws IOException {
48 return Runtime.getRuntime().exec(this.getCommand() + " " + arguments, null, workingDirectory);
51 public boolean equals(Object other) {
52 if (other instanceof PHPInterpreter) {
53 PHPInterpreter otherInterpreter = (PHPInterpreter) other;
54 if (name.equals(otherInterpreter.getName()))
55 return installLocation.equals(otherInterpreter.getInstallLocation());