Don't remove the last slash from "/" directory name under Unix.
This was totally wrong as it returned empty string as (invalid) directory name. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -235,10 +235,13 @@ wxString wxDir::GetName() const
|
||||
if ( m_data )
|
||||
{
|
||||
name = M_DIR->GetName();
|
||||
if ( !name.empty() && (name.Last() == wxT('/')) )
|
||||
|
||||
// Notice that we need to check for length > 1 as we shouldn't remove
|
||||
// the last slash from the root directory!
|
||||
if ( name.length() > 1 && (name.Last() == wxT('/')) )
|
||||
{
|
||||
// chop off the last (back)slash
|
||||
name.Truncate(name.length() - 1);
|
||||
// chop off the last slash
|
||||
name.RemoveLast();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user