fixed wxSplitPath() bug and added tests for it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-01-17 16:08:15 +00:00
parent f2b36d323e
commit 42b1f941b0
2 changed files with 34 additions and 13 deletions

View File

@@ -535,9 +535,12 @@ void wxFileName::SplitPath(const wxString& fullpath,
if ( pstrName )
{
// take all characters starting from the one after the last slash and
// up to, but excluding, the last dot
size_t nStart = posLastSlash == wxString::npos ? 0 : posLastSlash + 1;
size_t count = posLastDot == wxString::npos ? wxString::npos
: posLastDot - posLastSlash;
size_t count = posLastDot == wxString::npos
? wxString::npos
: posLastDot - posLastSlash - 1;
*pstrName = fullpath.Mid(nStart, count);
}