diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java index 852e3004be9..1cf563ad51a 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java @@ -374,8 +374,10 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM); } if (!programPath.isAbsolute()) { - IFile wsProgramPath = cproject.getProject().getFile(programPath); - programPath = wsProgramPath.getLocation(); + IPath location = project.getLocation(); + if (location != null) { + programPath = location.append(programPath); + } } if (!programPath.toFile().exists()) { abort( diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java index a9edcf14cf5..93515a6d554 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java @@ -552,20 +552,17 @@ public class CMainTab extends CLaunchConfigurationTab { } IPath exePath = new Path(name); if (!exePath.isAbsolute()) { - IFile projFile = null; - try { - projFile = project.getFile(name); - } - catch (Exception exc) { - // throws an exception if it's a relative path pointing outside project - setErrorMessage(LaunchMessages.getString("CMainTab.Program_invalid_proj_path")); //$NON-NLS-1$ - return false; - } - if (projFile == null || !projFile.exists()) { + IPath location = project.getLocation(); + if (location == null) { + setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ + return false; + } + + exePath = location.append(name); + if (!exePath.toFile().exists()) { setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ return false; } - exePath = projFile.getLocation(); } else { if (!exePath.toFile().exists()) { setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$