#include "wx/log.h"
-// No, Cygwin doesn't appear to have fnmatch.h after all.
-#if defined(HAVE_FNMATCH_H)
- #include "fnmatch.h"
-#endif
-
#ifdef __WINDOWS__
#include "wx/msw/private.h"
#include "wx/msw/mslu.h"
#if defined __MWERKS__ || defined __CYGWIN__
#include <io.h>
#endif
- #if defined __WINE__
- extern "C" { long _get_osfhandle(int); }
- #endif
#endif // __WINDOWS__
#if defined(__VMS__)
path such as "C:\Program Files" would be split into 2 paths:
"C:\Program" and "Files"
*/
-// wxT(" ;"); // Don't seperate with colon in DOS (used for drive)
- wxT(";"); // Don't seperate with colon in DOS (used for drive)
+// wxT(" ;"); // Don't separate with colon in DOS (used for drive)
+ wxT(";"); // Don't separate with colon in DOS (used for drive)
#else
wxT(" :;");
#endif
- wxString val ;
+ wxString val ;
if (wxGetEnv (WXSTRINGCAST envVariable, &val))
{
wxChar *s = MYcopystring (val);
void wxStripExtension(wxChar *buffer)
{
- int len = wxStrlen(buffer);
- int i = len-1;
- while (i > 0)
- {
- if (buffer[i] == wxT('.'))
+ int len = wxStrlen(buffer);
+ int i = len-1;
+ while (i > 0)
{
- buffer[i] = 0;
- break;
+ if (buffer[i] == wxT('.'))
+ {
+ buffer[i] = 0;
+ break;
+ }
+ i --;
}
- i --;
- }
}
void wxStripExtension(wxString& buffer)
bool
wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& file3)
{
- wxString outfile;
- if ( !wxGetTempFileName( wxT("cat"), outfile) )
- return false;
-
- FILE *fp1 wxDUMMY_INITIALIZE(NULL);
- FILE *fp2 = NULL;
- FILE *fp3 = NULL;
- // Open the inputs and outputs
- if ((fp1 = wxFopen ( file1, wxT("rb"))) == NULL ||
- (fp2 = wxFopen ( file2, wxT("rb"))) == NULL ||
- (fp3 = wxFopen ( outfile, wxT("wb"))) == NULL)
+#if wxUSE_FILE
+
+ wxFile in1(file1), in2(file2);
+ wxTempFile out(file3);
+
+ if ( !in1.IsOpened() || !in2.IsOpened() || !out.IsOpened() )
+ return false;
+
+ ssize_t ofs;
+ unsigned char buf[1024];
+
+ for( int i=0; i<2; i++)
{
- if (fp1)
- fclose (fp1);
- if (fp2)
- fclose (fp2);
- if (fp3)
- fclose (fp3);
- return false;
+ wxFile *in = i==0 ? &in1 : &in2;
+ do{
+ if ( (ofs = in->Read(buf,WXSIZEOF(buf))) == wxInvalidOffset ) return false;
+ if ( ofs > 0 )
+ if ( !out.Write(buf,ofs) )
+ return false;
+ } while ( ofs == (ssize_t)WXSIZEOF(buf) );
}
- int ch;
- while ((ch = getc (fp1)) != EOF)
- (void) putc (ch, fp3);
- fclose (fp1);
+ return out.Commit();
+
+#else
- while ((ch = getc (fp2)) != EOF)
- (void) putc (ch, fp3);
- fclose (fp2);
+ wxUnusedVar(file1);
+ wxUnusedVar(file2);
+ wxUnusedVar(file3);
+ return false;
- fclose (fp3);
- bool result = wxRenameFile(outfile, file3);
- return result;
+#endif
}
// Copy files