]> git.saurik.com Git - wxWidgets.git/blame - src/common/fs_zip.cpp
resolved a conflict
[wxWidgets.git] / src / common / fs_zip.cpp
CommitLineData
5526e819
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: fs_zip.cpp
3// Purpose: ZIP file system
4// Author: Vaclav Slavik
5// Copyright: (c) 1999 Vaclav Slavik
6// Licence: wxWindows Licence
7/////////////////////////////////////////////////////////////////////////////
8
9
10#ifdef __GNUG__
11#pragma implementation
12#endif
13
14#include <wx/wxprec.h>
15
16#ifdef __BORDLANDC__
17#pragma hdrstop
18#endif
19
e3e717ec
VZ
20#if wxUSE_FS_ZIP
21
5526e819
VS
22#ifndef WXPRECOMP
23#include <wx/wx.h>
24#endif
25
26#include "wx/filesys.h"
6001e347 27#include "wx/zipstrm.h"
5526e819
VS
28#include "wx/fs_zip.h"
29
30
31//--------------------------------------------------------------------------------
32// wxZipFSHandler
33//--------------------------------------------------------------------------------
34
35
36
37bool wxZipFSHandler::CanOpen(const wxString& location)
38{
39 wxString p = GetProtocol(location);
40 return (p == "zip");
41}
42
43
44
45
46wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
47{
48 wxString right = GetRightLocation(location);
49 wxString left = GetLeftLocation(location);
50 wxInputStream *s;
51
52 if (GetProtocol(left) != "file") {
53 return NULL;
54 }
55
56 s = new wxZipInputStream(left, right);
57 if (s && (s -> LastError() == wxStream_NOERROR)) {
58 return new wxFSFile(s,
59 left + "#zip:" + right,
60 GetMimeTypeFromExt(location),
61 GetAnchor(location));
62 }
63 else return NULL;
64}
65
66
67
68wxZipFSHandler::~wxZipFSHandler()
69{
70}
71
e3e717ec 72#endif // wxUSE_FS_ZIP