bugs 10806 + 10807 fix problems with program to launch RCL_2_4
authordadubrow
Mon, 01 Mar 2010 13:19:29 -0600
branchRCL_2_4
changeset 1041 7c4362faca1e
parent 1040 6028c6c9c6ad
child 1044 698d7a6c6f6a
child 1051 6c94b68cb6ba
bugs 10806 + 10807 fix problems with program to launch
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Mon Mar 01 12:53:06 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Mon Mar 01 13:19:29 2010 -0600
@@ -334,6 +334,9 @@
 		else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) {
     		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
 		}
+		if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE))
+			SettingsData.setProcessToLaunch(config, exeSelectionPath);
+		
 		addBuildOptions(config);
 		// always set the current connection id
 		config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID);
@@ -353,9 +356,20 @@
 	}
 
 	private IPath getExePath() {
+		// if attach, doesn't matter so return first exe
 		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
-			return exes.get(0);
-		return exeSelectionPath;
+			return exes.isEmpty() ? Path.EMPTY : exes.get(0);
+
+		// otherwise, see if we can use the selected path - process to launch string
+		// by checking if the file name matches any of the ones in our list of exes
+		String filename = exeSelectionPath.lastSegment();
+		for (IPath exePath : exes) {
+			if (filename.equalsIgnoreCase(exePath.lastSegment())) {
+				return exePath;
+			}
+		}
+		// none could be found matching the selected path, so use the first in the list
+		return exes.isEmpty() ? Path.EMPTY : exes.get(0);
 	}
 	
 	private IConnectedService getConnectedService() {