From eea63bc9a9b0293fc99e47f04c6c17a98edfa55f Mon Sep 17 00:00:00 2001 From: cperkonig Date: Wed, 5 Oct 2005 10:32:53 +0000 Subject: [PATCH] Quick fix for the Environment Vars. --- .../launching/PHPLaunchConfigurationDelegate.java | 28 ++++++++++++------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java index be1286b..6117961 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java @@ -14,7 +14,9 @@ package net.sourceforge.phpeclipse.xdebug.php.launching; 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; @@ -74,7 +76,6 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate } 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); @@ -83,20 +84,27 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate 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