import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import net.sourceforge.phpeclipse.xdebug.core.IXDebugPreferenceConstants;
import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
}
commandList.add(file.getLocation().toOSString());
- String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
// Get de Debugport form the Launchconfiguration or from the preferences
int debugPort = configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT,-1);
debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE);
if (debugPort<1024)
debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT;
-
+
+ String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
+ // appends the environment to the native environment
+ if (envp==null) {
+ Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
+ int idx=0;
+ envp= new String[stringVars.size()];
+ for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
+ String key = (String) i.next();
+ String value = (String) stringVars.get(key);
+ envp[idx++]=key+"="+value;
+ }
+ }
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- String[] env;
- if (envp!=null) {
- env = new String[envp.length+1];
- for(int i=0;i<envp.length;i++)
+ String[] env = new String[envp.length+1];
+ for(int i=0;i<envp.length;i++)
env[i+1]=envp[i];
- } else
- env = new String[1];
env[0]="XDEBUG_CONFIG=idekey=xdebug_test remote_enable=1";
envp=env;
}
-
-
+
String[] commandLine = (String[]) commandList.toArray(new String[commandList.size()]);
Process process = DebugPlugin.exec(commandLine, null,envp);
IProcess p = DebugPlugin.newProcess(launch, process, phpInterpreter);