bool wxInternetFSHandler::CanOpen(const wxString& location)
{
+#if wxUSE_URL
wxString p = GetProtocol(location);
if ((p == wxT("http")) || (p == wxT("ftp")))
{
wxURL url(p + wxT(":") + StripProtocolAnchor(location));
return (url.GetError() == wxURL_NOERR);
}
-
+#endif
return false;
}
wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
const wxString& location)
{
+#if !wxUSE_URL
+ return NULL;
+#else
wxString right =
GetProtocol(location) + wxT(":") + StripProtocolAnchor(location);
}
return (wxFSFile*) NULL; // incorrect URL
+#endif
}
wxInputStream *wxFTP::GetInputStream(const wxString& path)
{
+#if !wxUSE_URL
+ return NULL;
+#else
if ( ( m_currentTransfermode == NONE ) && !SetTransferMode(BINARY) )
return NULL;
wxInputFTPStream *in_stream = new wxInputFTPStream(this, sock);
return in_stream;
+#endif
}
wxOutputStream *wxFTP::GetOutputStream(const wxString& path)
{
m_cinfo = info;
m_needhost = need_host1;
+#if wxUSE_URL
next = wxURL::ms_protocols;
wxURL::ms_protocols = this;
+#else
+ next = NULL;
+#endif
}
/////////////////////////////////////////////////////////////////
wxInputStream *wxFileProto::GetInputStream(const wxString& path)
{
- wxFileInputStream* retval = new wxFileInputStream(wxURL::ConvertFromURI(path));
+#if !wxUSE_URL
+ return NULL;
+#else
+ wxFileInputStream* retval = new wxFileInputStream(wxURL::ConvertFromURI(path));
if (retval->Ok()) {
return retval;
} else {
delete retval;
return 0;
}
+#endif
}
#endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE