From e123e11d87b3c6469cd972846bb44fe73d27ba94 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Tue, 26 Aug 2008 23:17:04 +0000 Subject: [PATCH] Restore support for a program specification that is a linked resource --- .../cdt/launch/AbstractCLaunchDelegate.java | 11 +++++++++++ .../src/org/eclipse/cdt/launch/ui/CMainTab.java | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) 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 9982a73fc98..620d7a0a926 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 @@ -377,6 +377,17 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat IPath location = cproject.getProject().getLocation(); if (location != null) { programPath = location.append(programPath); + if (!programPath.toFile().exists()) { + // Try the old way, which is required to support linked resources. + IFile projFile = null; + try { + projFile = project.getFile(getProgramPath(config)); + } + catch (IllegalArgumentException exc) {} // thrown if relative path that resolves to a root file (e.g., "..\somefile") + if (projFile != null && projFile.exists()) { + programPath = projFile.getLocation(); + } + } } } if (!programPath.toFile().exists()) { 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 8904c1f058e..fb3cf43ddc3 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 @@ -33,6 +33,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchMessages; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.ui.CElementLabelProvider; import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; @@ -558,6 +559,21 @@ public class CMainTab extends CLaunchConfigurationTab { } exePath = location.append(name); + if (!exePath.toFile().exists()) { + // Try the old way, which is required to support linked resources. + IFile projFile = null; + try { + projFile = project.getFile(name); + } + catch (IllegalArgumentException exc) {} // thrown if relative path that resolves to a root file ("..\somefile") + if (projFile == null || !projFile.exists()) { + setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ + return false; + } + else { + exePath = projFile.getLocation(); + } + } } if (!exePath.toFile().exists()) { setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$