diff options
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index f2ebc03a07d..c8f8ff2b087 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -298,14 +298,16 @@ IcePatch2::getWithoutSuffix(const string& pa) { const string path = simplify(pa); - string::size_type pos = path.rfind('.'); - if(pos == string::npos) + string::size_type dotPos = path.rfind('.'); + string::size_type slashPos = path.rfind('/'); + + if(dotPos == string::npos || slashPos != string::npos && slashPos > dotPos) { return path; } else { - return path.substr(0, pos); + return path.substr(0, dotPos); } } |