mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Improved GCCToolChain.stripCommand()
GCCToolChain.stripCommand() assumed that all resources are at the end
of the command, like in the old version of
GCCToolChain.getResourcesFromCommand() which was fixed in PR #311 (see
commit a89ce59df2
). Now stripCommand() is in line with
getResourcesFromCommand().
This commit is contained in:
parent
82a235fbb9
commit
f40f957c6c
1 changed files with 14 additions and 7 deletions
|
@ -721,17 +721,24 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
|||
public List<String> stripCommand(List<String> command, IResource[] resources) {
|
||||
List<String> newCommand = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < command.size() - resources.length; ++i) {
|
||||
for (int i = 0; i < command.size(); ++i) {
|
||||
String arg = command.get(i);
|
||||
if (arg.startsWith("-o")) { //$NON-NLS-1$
|
||||
if (arg.equals("-o")) { //$NON-NLS-1$
|
||||
i++;
|
||||
}
|
||||
if (arg.equals("-o")) { //$NON-NLS-1$
|
||||
// this is an output file, skip.
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
newCommand.add(arg);
|
||||
if (arg.startsWith("-")) { //$NON-NLS-1$
|
||||
// ran into an option, add.
|
||||
newCommand.add(arg);
|
||||
continue;
|
||||
}
|
||||
String ext = getFileExtension(arg);
|
||||
if (!resourcesFileExtensions.contains(ext)) {
|
||||
// not a resource, add.
|
||||
newCommand.add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return newCommand;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue