X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dc3d889d0bb65725e521963d4f47019884a6d7c8..6443de026310552cacd68a6d0318e73d14929680:/src/unix/dir.cpp 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;