1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 318738 - Incorrect chopping of weird paths in option value like ${workspace_loc:/proj}/path

This commit is contained in:
James Blackburn 2010-07-02 14:46:28 +00:00
parent d5ea7d1248
commit 2a0ae90a25

View file

@ -3888,10 +3888,17 @@ public class ManagedBuildManager extends AbstractCExtension {
return fullPath;
}
/**
* Returns a string representing the workspace relative path with ${workspace_loc: stripped
* or null if the String path doesn't contain workspace_log
* @param path String path to have workspace_loc removed
* @return workspace path or null
*/
public static String locationToFullPath(String path){
path = path.trim();
if(!path.startsWith("${")) //$NON-NLS-1$
return null;
int index = path.lastIndexOf('}');
final int index = path.lastIndexOf('}');
if(index == -1)
return null;
@ -3907,6 +3914,10 @@ public class ManagedBuildManager extends AbstractCExtension {
} else {
result = "/"; //$NON-NLS-1$
}
// If the user has a path like ${workspace_loc:/thing}/other/thing
// ensure we return /thing/other/thing
if (index < path.length() - 1)
result += path.substring(index + 1);
}
return result;