- // if bOverwrite we create a new file or truncate the existing one,
- // otherwise we only create the new file and fail if it already exists
- int fd = open(szFileName, O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL));
-
- if ( fd == -1 ) {
- wxLogSysError("can't create file '%s'", szFileName);
- return FALSE;
- }
- else {
- Attach(fd);
- return TRUE;
- }
+ // if bOverwrite we create a new file or truncate the existing one,
+ // otherwise we only create the new file and fail if it already exists
+#if defined(__WXMAC__) && !defined(__UNIX__)
+ // Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
+ // int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
+ int fd = creat( szFileName , accessMode);
+#else
+ int fd = wxOpen(wxFNCONV(szFileName),
+ O_BINARY | O_WRONLY | O_CREAT |
+ (bOverwrite ? O_TRUNC : O_EXCL)
+ ACCESS(accessMode));
+#endif
+ if ( fd == -1 ) {
+ wxLogSysError(_("can't create file '%s'"), szFileName);
+ return FALSE;
+ }
+ else {
+ Attach(fd);
+ return TRUE;
+ }