#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__
#if wxUSE_UNICODE && wxMBFILES
wxCharBuffer fname = wxConvFile.cWC2MB(name);
-#ifdef __WXMAC__
- 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
-#ifdef __WXMAC__
- 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 bOverwrite we create a new file or truncate the existing one,
// otherwise we only create the new file and fail if it already exists
-#ifdef __WXMAC__
+#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;
}
-#ifdef __WXMAC__
- 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();
-#ifndef __WXMAC__
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();
-#ifndef __WXMAC__
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