mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
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.
This commit is contained in:
parent
c178e29335
commit
b9f5b7a7d4
2 changed files with 12 additions and 13 deletions
|
@ -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(
|
||||
|
|
|
@ -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$
|
||||
|
|
Loading…
Add table
Reference in a new issue