m_lastDirectory = wxPathOnly(pathTmp);
path = pathTmp;
- wxString theExt = FindExtension(path);
- if (!theExt)
- return (wxDocTemplate *) NULL;
// This is dodgy in that we're selecting the template on the
// basis of the file extension, which may not be a standard
fclose (fd1);
return TRUE;
}
+#else
+bool wxTransferFileToStream(const wxString& filename, wxOutputStream& stream)
+{
+ FILE *fd1;
+ int ch;
+
+ if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL)
+ return FALSE;
+
+ while ((ch = getc (fd1)) != EOF)
+ stream.PutC((char) ch);
+
+ fclose (fd1);
+ return TRUE;
+}
+
+bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
+{
+ FILE *fd1;
+ char ch;
+
+ if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL)
+ {
+ return FALSE;
+ }
+
+ int len = stream.StreamSize();
+ // TODO: is this the correct test for EOF?
+ while (stream.TellI() < (len - 1))
+ {
+ ch = stream.GetC();
+ putc (ch, fd1);
+ }
+ fclose (fd1);
+ return TRUE;
+}
#endif
#endif // wxUSE_DOC_VIEW_ARCHITECTURE