X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e8d860761774a8e54ba9caa8a1dc38380332a9a..3d0145a5a3354d48c7a81fd27a6f5e88dfd51763:/src/common/filename.cpp diff --git a/src/common/filename.cpp b/src/common/filename.cpp index e0c45c36ff..3bb8694534 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -249,7 +249,7 @@ bool wxFileName::Normalize(wxPathNormalize flags, { curDir.AssignDir(wxGetUserHome(dir.c_str() + 1)); - dirs.Remove(0u); + dirs.RemoveAt(0u); } } } @@ -432,6 +432,11 @@ void wxFileName::RemoveDir( int pos ) // accessors // ---------------------------------------------------------------------------- +void wxFileName::SetFullName(const wxString& fullname) +{ + SplitPath(fullname, NULL /* no path */, &m_name, &m_ext); +} + wxString wxFileName::GetFullName() const { wxString fullname = m_name; @@ -530,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); }