X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dc3d889d0bb65725e521963d4f47019884a6d7c8..057b55b016d9e2076fde422f29948dc55e97f0d7:/src/unix/dir.cpp?ds=sidebyside diff --git a/src/unix/dir.cpp b/src/unix/dir.cpp index 121ccda391..13b8d2a68a 100644 --- a/src/unix/dir.cpp +++ b/src/unix/dir.cpp @@ -65,6 +65,8 @@ public: void Rewind() { rewinddir(m_dir); } bool Read(wxString *filename); + const wxString& GetName() const { return m_dirname; } + private: DIR *m_dir; @@ -228,6 +230,22 @@ bool wxDir::IsOpened() const return m_data != NULL; } +wxString wxDir::GetName() const +{ + wxString name; + if ( m_data ) + { + name = M_DIR->GetName(); + if ( !name.empty() && (name.Last() == _T('/')) ) + { + // chop off the last (back)slash + name.Truncate(name.length() - 1); + } + } + + return name; +} + wxDir::~wxDir() { delete M_DIR;