]> git.saurik.com Git - wxWidgets.git/blob - src/common/sckfile.cpp
set m_error correctly (patch 1249848)
[wxWidgets.git] / src / common / sckfile.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sckfile.cpp
3 // Purpose: File protocol
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 20/07/97
7 // RCS-ID: $Id$
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "sckfile.h"
13 #endif
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #ifndef WX_PRECOMP
23 #include "wx/defs.h"
24 #endif
25
26 #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE
27
28 #include <stdio.h>
29 #include "wx/wfstream.h"
30 #include "wx/protocol/file.h"
31
32 IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
33 IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false)
34
35 wxFileProto::wxFileProto()
36 : wxProtocol()
37 {
38 m_error = wxPROTO_NOERR;
39 }
40
41 wxFileProto::~wxFileProto()
42 {
43 }
44
45 wxInputStream *wxFileProto::GetInputStream(const wxString& path)
46 {
47 wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path));
48 if ( retval->Ok() )
49 {
50 m_error = wxPROTO_NOERR;
51
52 return retval;
53 }
54
55 m_error = wxPROTO_NOFILE;
56 delete retval;
57
58 return NULL;
59 }
60
61 #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE
62