X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad0dc53bffdcc40f0b8528c30927d6ebc1fe9cbd..300b5dfabc6f7f0d9fc3f7865374b43e79c8f465:/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;