+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+ // CopyFile() copies file attributes and modification time too, so use it
+ // instead of our code if available
+ //
+ // NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite
+ return ::CopyFile(file1, file2, !overwrite) != 0;
+#else // !Win32
+ wxStructStat fbuf;
+
+ // get permissions of file1
+ if ( wxStat(OS_FILENAME(file1), &fbuf) != 0 )
+ {
+ // the file probably doesn't exist or we haven't the rights to read
+ // from it anyhow
+ wxLogSysError(_("Impossible to get permissions for file '%s'"),
+ file1.c_str());
+ return FALSE;
+ }
+
+ // open file1 for reading
+ wxFile fileIn(file1, wxFile::read);