diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmIncludeDirectoryCommand.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 1c8bcc1..8404bc8 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -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); |