X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad0dc53bffdcc40f0b8528c30927d6ebc1fe9cbd..8a2a6bbf9c9cf5a5aa913f805e893e61d0dae53b:/src/msw/dir.cpp diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp index 5fe20263aa..7d505e56bc 100644 --- a/src/msw/dir.cpp +++ b/src/msw/dir.cpp @@ -28,6 +28,11 @@ #pragma hdrstop #endif +// For _A_SUBDIR, etc. +#if defined(__BORLANDC__) && defined(__WIN16__) +#include +#endif + #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/log.h" @@ -210,6 +215,8 @@ public: void Rewind(); bool Read(wxString *filename); + const wxString& GetName() const { return m_dirname; } + private: FIND_DATA m_finddata; @@ -398,6 +405,28 @@ bool wxDir::IsOpened() const return m_data != NULL; } +wxString wxDir::GetName() const +{ + wxString name; + if ( m_data ) + { + name = M_DIR->GetName(); + if ( !name.empty() ) + { + // bring to canonical Windows form + name.Replace(_T("/"), _T("\\")); + + if ( name.Last() == _T('\\') ) + { + // chop off the last (back)slash + name.Truncate(name.length() - 1); + } + } + } + + return name; +} + wxDir::~wxDir() { delete M_DIR;