]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fs_zip.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: ZIP file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation
14 #include <wx/wxprec.h>
22 #define wxUSE_FS_ZIP 0
31 #include "wx/filesys.h"
32 #include "wx/zipstream.h"
33 #include "wx/fs_zip.h"
36 //--------------------------------------------------------------------------------
38 //--------------------------------------------------------------------------------
42 bool wxZipFSHandler::CanOpen(const wxString
& location
)
44 wxString p
= GetProtocol(location
);
51 wxFSFile
* wxZipFSHandler::OpenFile(wxFileSystem
& WXUNUSED(fs
), const wxString
& location
)
53 wxString right
= GetRightLocation(location
);
54 wxString left
= GetLeftLocation(location
);
57 if (GetProtocol(left
) != "file") {
61 s
= new wxZipInputStream(left
, right
);
62 if (s
&& (s
-> LastError() == wxStream_NOERROR
)) {
63 return new wxFSFile(s
,
64 left
+ "#zip:" + right
,
65 GetMimeTypeFromExt(location
),
73 wxZipFSHandler::~wxZipFSHandler()
77 #endif // wxUSE_FS_ZIP