X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ba75c6bb8c85705aca6b46871e0fc6548f15a73d..0d91b2342a1f83b3b9db145c7210efd5d9547cc8:/src/common/fs_zip.cpp diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index d2b6100cc2..b8ef9b69f9 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -7,12 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "fs_zip.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -71,13 +65,17 @@ wxZipFSHandler::wxZipFSHandler() : wxFileSystemHandler() wxZipFSHandler::~wxZipFSHandler() { - if (m_Archive) - delete m_Archive; - if (m_DirsFound) - delete m_DirsFound; + Cleanup(); } +void wxZipFSHandler::Cleanup() +{ + wxDELETE(m_Archive); + wxDELETE(m_DirsFound); +} + + bool wxZipFSHandler::CanOpen(const wxString& location) { @@ -110,25 +108,36 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l s = new wxZipFSInputStream(leftFile); if (s && s->IsOk()) { +#if wxUSE_DATETIME + wxDateTime dtMod; +#endif // wxUSE_DATETIME + bool found = false; while (!found) { wxZipEntry *ent = s->GetNextEntry(); if (!ent) break; + if (ent->GetInternalName() == right) + { found = true; + dtMod = ent->GetDateTime(); + } + delete ent; } if (found) + { return new wxFSFile(s, left + wxT("#zip:") + right, GetMimeTypeFromExt(location), GetAnchor(location) #if wxUSE_DATETIME - , wxDateTime(wxFileModificationTime(left)) + , dtMod #endif // wxUSE_DATETIME ); + } } delete s;