diff options
author | John Cortell | 2008-08-20 20:50:17 +0000 |
---|---|---|
committer | John Cortell | 2008-08-20 20:50:17 +0000 |
commit | b9f5b7a7d48ea4a8c02958538d24602f58e975de (patch) | |
tree | e59a1028a042669676c5e868a899ae5ffd65d1ca /launch | |
parent | c178e29335cd02c148d2963d8fd9587f0333ef65 (diff) | |
download | org.eclipse.cdt-b9f5b7a7d48ea4a8c02958538d24602f58e975de.tar.gz org.eclipse.cdt-b9f5b7a7d48ea4a8c02958538d24602f58e975de.tar.xz org.eclipse.cdt-b9f5b7a7d48ea4a8c02958538d24602f58e975de.zip |
Support specifying the program as a relative path pointing outside the project directory. This is currently blocked merely because of shortcomings in the validation logic. There is no hard requirement otherwise for the executable to be in the project directory. In fact, the code I'm tweaking already supports the program being specified as an absolute path. Not allowing a relative path to the same location (or any other valid location) doesn't make sense.
Diffstat (limited to 'launch')
-rw-r--r-- | launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java | 6 | ||||
-rw-r--r-- | launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java | 17 |
2 files changed, 11 insertions, 12 deletions
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$ + IPath location = project.getLocation(); + if (location == null) { + setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ return false; - } - if (projFile == null || !projFile.exists()) { + } + + 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$ |