00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014 #include "wx/wxprec.h"
00015
00016 #ifdef __BORLANDC__
00017 #pragma hdrstop
00018 #endif
00019
00020 #ifndef WX_PRECOMP
00021 #include "wx/wx.h"
00022 #endif
00023
00024
00025 #include <wx/filesys.h>
00026 #include "wxp/fs_wxz.h"
00027
00028
00029
00030
00031
00032
00033 IMPLEMENT_DYNAMIC_CLASS(wxWxzFSHandler, wxFileSystemHandler)
00034
00035 bool wxWxzFSHandler::CanOpen(const wxString& location)
00036 {
00037 wxString p = GetProtocol(location);
00038 return p == wxT("wxz");
00039 }
00040
00041 wxFSFile* wxWxzFSHandler::OpenFile(wxFileSystem& fs, const wxString& location)
00042 {
00043 wxString right = GetRightLocation(location);
00044 wxString left = GetLeftLocation(location);
00045
00046
00047
00048
00049
00050
00051 wxString ext = wxFileName(left).GetExt();
00052
00053
00054
00055 wxString newloc;
00056 if (left.EndsWith(wxT(".tar.gz")))
00057 {
00058
00059
00060
00061 newloc = left + wxT("#gzip:#tar:") + right;
00062 }
00063 else
00064 {
00065
00066 newloc = left + wxT("#") + ext + wxT(":") + right;
00067 }
00068
00069
00070 wxFileSystem temp;
00071 return temp.OpenFile(newloc);
00072 }
00073
00074 wxString wxWxzFSHandler::FindFirst(const wxString& spec, int flags)
00075 {
00076 return wxEmptyString;
00077 }
00078
00079 wxString wxWxzFSHandler::FindNext()
00080 {
00081 return wxEmptyString;
00082 }
00083
00084