diff options
author | Michi Henning <michi@zeroc.com> | 2005-02-21 01:32:38 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-02-21 01:32:38 +0000 |
commit | b6e50d912d0a16117fc302549502b9a11c47ff7f (patch) | |
tree | 2eba8bc29c2ce4b97b3d0e371bcf6863c5e77b96 /cpp/src/IcePatch2/Util.cpp | |
parent | Fixed bug in getSuffix: it was returning "c/d" for a path such as (diff) | |
download | ice-b6e50d912d0a16117fc302549502b9a11c47ff7f.tar.bz2 ice-b6e50d912d0a16117fc302549502b9a11c47ff7f.tar.xz ice-b6e50d912d0a16117fc302549502b9a11c47ff7f.zip |
Fixed bug in getWithoutSuffix(). It was returning "a/b" for a path such as
"a/b.c/d".
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); } } |