|
|
@@ -94,22 +94,17 @@ void cmIncludeDirectoryCommand::AddDirectory(const char *i,
|
|
|
}
|
|
|
|
|
|
// remove any leading or trailing spaces and \r
|
|
|
- pos = ret.size()-1;
|
|
|
- while(ret[pos] == ' ' || ret[pos] == '\r')
|
|
|
+ std::string::size_type b = ret.find_first_not_of(" \r");
|
|
|
+ std::string::size_type e = ret.find_last_not_of(" \r");
|
|
|
+ if ((b!=ret.npos) && (e!=ret.npos))
|
|
|
{
|
|
|
- ret.erase(pos);
|
|
|
- pos--;
|
|
|
+ ret.assign(ret, b, 1+e-b); // copy the remaining substring
|
|
|
}
|
|
|
- pos = 0;
|
|
|
- while(ret.size() && ret[pos] == ' ' || ret[pos] == '\r')
|
|
|
+ else
|
|
|
{
|
|
|
- ret.erase(pos,1);
|
|
|
+ return; // if we get here, we had only whitespace in the string
|
|
|
}
|
|
|
- if (!ret.size())
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
if (!cmSystemTools::IsOff(ret.c_str()))
|
|
|
{
|
|
|
cmSystemTools::ConvertToUnixSlashes(ret);
|