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
27 // workingDirectory, String[] env) {
28 // Process process = null;
30 // StringBuffer buf = new StringBuffer();
31 // buf.append(getCommand() + " " + arguments);
32 // process = Runtime.getRuntime().exec(buf.toString(), env,
34 // if (process != null) {
35 // // construct a formatted command line for the process properties
37 // // for (int i= 0; i < args.length; i++) {
38 // // buf.append(args[i]);
39 // // buf.append(' ');
42 // ILaunchConfigurationWorkingCopy wc = null;
44 // ILaunchConfigurationType lcType =
45 // DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(
46 // PHPLaunchConfigurationAttribute.PHP_LAUNCH_CONFIGURATION_TYPE);
47 // String name = "PHP Launcher"; //$NON-NLS-1$
48 // wc = lcType.newInstance(null, name);
49 // wc.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, true);
51 // ILaunch newLaunch = new Launch(wc, ILaunchManager.RUN_MODE, null);
52 // IProcess iprocess = DebugPlugin.newProcess(newLaunch, process, "PHP
53 // Process"); //$NON-NLS-1$
54 // iprocess.setAttribute(IProcess.ATTR_CMDLINE, buf.toString());
55 // iprocess.setAttribute(IProcess.ATTR_PROCESS_TYPE,
56 // PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE);
58 // DebugPlugin.getDefault().getLaunchManager().addLaunch(newLaunch);
60 // } catch (CoreException e) {
66 // } catch (IOException e) {
73 public Process exec(String arguments, File workingDirectory, String[] env)
75 return Runtime.getRuntime().exec(getCommand() + " " + arguments, env,
77 // executePHPProcess(arguments, workingDirectory, env);
80 public boolean equals(Object other) {
81 if (other instanceof PHPInterpreter) {
82 PHPInterpreter otherInterpreter = (PHPInterpreter) other;
83 return installLocation
84 .equals(otherInterpreter.getInstallLocation());