1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Restore support for a program specification that is a linked resource

This commit is contained in:
John Cortell 2008-08-26 23:17:04 +00:00
parent 54d0aeb51f
commit e123e11d87
2 changed files with 27 additions and 0 deletions

View file

@ -377,6 +377,17 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
IPath location = cproject.getProject().getLocation(); IPath location = cproject.getProject().getLocation();
if (location != null) { if (location != null) {
programPath = location.append(programPath); 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()) { if (!programPath.toFile().exists()) {

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.ui.CElementLabelProvider; import org.eclipse.cdt.ui.CElementLabelProvider;
import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
@ -558,6 +559,21 @@ public class CMainTab extends CLaunchConfigurationTab {
} }
exePath = location.append(name); 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()) { if (!exePath.toFile().exists()) {
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$