#if wxUSE_FILE
// standard
-#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXWINE__)
+#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__WXMICROWIN__)
#include <io.h>
#ifndef __SALFORDC__
#ifndef __MWERKS__
#include <sys/types.h> // needed for stat
#include <sys/stat.h> // stat
+#elif ( defined(__MWERKS__) && defined(__WXMSW__) )
+ #include <sys/types.h> // needed for stat
+ #include <sys/stat.h> // stat
#endif
#if defined(__BORLANDC__) || defined(_MSC_VER)
#if wxUSE_UNICODE && wxMBFILES
wxCharBuffer fname = wxConvFile.cWC2MB(name);
-#if defined(__WXMAC__) && !defined(__UNIX__)
- return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
-#else
return !wxAccess(fname, 0) &&
!wxStat(wxMBSTRINGCAST fname, &st) &&
(st.st_mode & S_IFREG);
-#endif
-#else
-#if defined(__WXMAC__) && !defined(__UNIX__)
- return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
+
#else
return !wxAccess(name, 0) &&
!wxStat(name, &st) &&
(st.st_mode & S_IFREG);
#endif
-#endif
}
bool wxFile::Access(const wxChar *name, OpenMode mode)
#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(wxUnix2MacFilename( szFileName ), accessMode);
+ int fd = creat( szFileName , accessMode);
#else
int fd = wxOpen(wxFNCONV(szFileName),
O_BINARY | O_WRONLY | O_CREAT |
break;
}
-#if defined(__WXMAC__) && !defined(__UNIX__)
- int fd = open(wxUnix2MacFilename( szFileName ), flags, access);
-#else
int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
-#endif
if ( fd == -1 ) {
wxLogSysError(_("can't open file '%s'"), szFileName);
return FALSE;
// OS/2 supports that have them (HPFS, FAT32) and security (HPFS386)
static const wxChar *szMktempSuffix = wxT("XXX");
m_strTemp << strName << szMktempSuffix;
+ // Temporarily remove - MN
+ #ifndef __WATCOMC__
::DosCreateDir(m_strTemp.GetWriteBuf(MAX_PATH), NULL);
+ #endif
#else // Windows
wxString strPath;
wxSplitPath(strName, &strPath, NULL, NULL);
{
m_file.Close();
-#if !defined(__WXMAC__) || defined(__UNIX__)
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
return FALSE;
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
return FALSE;
}
-#else
- if ( wxFile::Exists(m_strName) && remove(wxUnix2MacFilename( m_strName )) != 0 ) {
- wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
- return FALSE;
- }
-
- if ( rename(wxUnix2MacFilename( m_strTemp ), wxUnix2MacFilename( m_strName )) != 0 ) {
- wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
- return FALSE;
- }
-#endif
return TRUE;
}
void wxTempFile::Discard()
{
m_file.Close();
-#if !defined(__WXMAC__) || defined(__UNIX__)
if ( wxRemove(m_strTemp) != 0 )
wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
-#else
- if ( remove( wxUnix2MacFilename(m_strTemp.fn_str())) != 0 )
- wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
-#endif
}
#endif