1 package net.sourceforge.phpdt.internal.launching;
4 import java.io.IOException;
6 public class PHPInterpreter {
8 protected File installLocation;
10 public PHPInterpreter(File interpreter) {
11 installLocation = interpreter;
14 public File getInstallLocation() {
15 return installLocation;
18 public void setInstallLocation(File interpreter) {
19 installLocation = interpreter;
22 public String getCommand() {
23 return installLocation.toString();
26 // private boolean executePHPProcess(String arguments, File workingDirectory, String[] env) {
27 // Process process = null;
29 // StringBuffer buf = new StringBuffer();
30 // buf.append(getCommand() + " " + arguments);
31 // process = Runtime.getRuntime().exec(buf.toString(), env, workingDirectory);
32 // if (process != null) {
33 // // construct a formatted command line for the process properties
35 // // for (int i= 0; i < args.length; i++) {
36 // // buf.append(args[i]);
37 // // buf.append(' ');
40 // ILaunchConfigurationWorkingCopy wc = null;
42 // ILaunchConfigurationType lcType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(
43 // PHPLaunchConfigurationAttribute.PHP_LAUNCH_CONFIGURATION_TYPE);
44 // String name = "PHP Launcher"; //$NON-NLS-1$
45 // wc = lcType.newInstance(null, name);
46 // wc.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, true);
48 // ILaunch newLaunch = new Launch(wc, ILaunchManager.RUN_MODE, null);
49 // IProcess iprocess = DebugPlugin.newProcess(newLaunch, process, "PHP Process"); //$NON-NLS-1$
50 // iprocess.setAttribute(IProcess.ATTR_CMDLINE, buf.toString());
51 // iprocess.setAttribute(IProcess.ATTR_PROCESS_TYPE, PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE);
53 // DebugPlugin.getDefault().getLaunchManager().addLaunch(newLaunch);
55 // } catch (CoreException e) {
61 // } catch (IOException e) {
68 public Process exec(String arguments, File workingDirectory, String[] env) throws IOException {
69 return Runtime.getRuntime().exec(getCommand() + " " + arguments, env, workingDirectory);
70 // executePHPProcess(arguments, workingDirectory, env);
73 public boolean equals(Object other) {
74 if (other instanceof PHPInterpreter) {
75 PHPInterpreter otherInterpreter = (PHPInterpreter) other;
76 return installLocation.equals(otherInterpreter.getInstallLocation());