mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug #186776: simplify make command parsing.
This commit is contained in:
parent
67211f8e0a
commit
dd026998ce
1 changed files with 5 additions and 31 deletions
|
@ -475,38 +475,12 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String parseMakeCommand(String rawCommand) {
|
private String parseMakeCommand(String rawCommand) {
|
||||||
StringBuffer command = new StringBuffer();
|
|
||||||
|
|
||||||
// Try to separate out the command from the arguments
|
|
||||||
String[] result = rawCommand.split("\\s"); //$NON-NLS-1$
|
String[] result = rawCommand.split("\\s"); //$NON-NLS-1$
|
||||||
/*
|
if (result != null && result.length > 0)
|
||||||
* Here are the cases to consider:
|
return result[0];
|
||||||
* cmd First segment is last segment, assume is command
|
else
|
||||||
* cmd [flags] First segment is the command
|
return rawCommand;
|
||||||
* path/cmd [flags] Same as above
|
|
||||||
* path with space/make [flags] Must append each segment up-to flags as command
|
|
||||||
*/
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
|
||||||
// Get the segment
|
|
||||||
String cmdSegment = result[i];
|
|
||||||
// If there is not another segment, we found the end
|
|
||||||
if (i + 1 >= result.length) {
|
|
||||||
command.append(cmdSegment);
|
|
||||||
} else {
|
|
||||||
// See if the next segment is the start of the flags
|
|
||||||
String nextSegment = result[i + 1];
|
|
||||||
if (nextSegment.startsWith("-")) { //$NON-NLS-1$
|
|
||||||
// we have found the end of the command
|
|
||||||
command.append(cmdSegment);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
command.append(cmdSegment);
|
|
||||||
// Add the whitespace back
|
|
||||||
command.append(" "); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return command.toString().trim();
|
|
||||||
}
|
}
|
||||||
// This page can be displayed for project only
|
// This page can be displayed for project only
|
||||||
public boolean canBeVisible() {
|
public boolean canBeVisible() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue