- Fix regression with read-only wxComboBox appearance (Jason Erb).
+Unix:
+
+- Fix bug with wxDir("/").GetName() returning empty string.
+
2.9.3: (released 2011-12-14)
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();
}
}
CPPUNIT_TEST( DirExists );
CPPUNIT_TEST( Traverse );
CPPUNIT_TEST( Enum );
+ CPPUNIT_TEST( GetName );
CPPUNIT_TEST_SUITE_END();
void DirExists();
void Traverse();
void Enum();
+ void GetName();
void CreateTempFile(const wxString& path);
wxArrayString DirEnumHelper(wxDir& dir,
CPPUNIT_ASSERT( wxDir::Exists(wxGetCwd()) );
}
+void DirTestCase::GetName()
+{
+ wxDir d;
+
+ CPPUNIT_ASSERT( d.Open(".") );
+ CPPUNIT_ASSERT( d.GetName().Last() != wxFILE_SEP_PATH );
+
+#ifdef __UNIX__
+ CPPUNIT_ASSERT( d.Open("/") );
+ CPPUNIT_ASSERT_EQUAL( "/", d.GetName() );
+#endif
+}