- #if wxUSE_UNICODE
- #define wxNEED_WX_UNISTD_H
- #if defined(__DMC__)
- typedef unsigned long mode_t;
- #endif
- WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf );
- WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode );
- WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode );
- #else
- #define wxOpen open
- #define wxStat stat
- #define wxAccess access
- #endif
+ #define wxCRT_Open open
+ #define wxCRT_Stat stat
+ #define wxCRT_Lstat lstat
+ #define wxCRT_Access access
+
+ #define wxHAS_NATIVE_LSTAT
+#endif // platforms
+
+// if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as
+// wxCRT_Stat to avoid #ifdefs in the code using it
+#ifndef wxHAS_NATIVE_LSTAT
+ #define wxCRT_Lstat wxCRT_Stat
+#endif
+
+inline int wxAccess(const wxString& path, mode_t mode)
+ { return wxCRT_Access(path.fn_str(), mode); }
+inline int wxOpen(const wxString& path, int flags, mode_t mode)
+ { return wxCRT_Open(path.fn_str(), flags, mode); }
+
+// FIXME-CE: provide our own implementations of the missing CRT functions
+#ifndef __WXWINCE__
+inline int wxStat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Stat(path.fn_str(), buf); }
+inline int wxLstat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Lstat(path.fn_str(), buf); }
+inline int wxRmDir(const wxString& path)
+ { return wxCRT_RmDir(path.fn_str()); }
+#if defined(__WINDOWS__) || (defined(__OS2__) && defined(__WATCOMC__))
+inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0)
+ { return wxCRT_MkDir(path.fn_str()); }
+#else
+inline int wxMkDir(const wxString& path, mode_t mode)
+ { return wxCRT_MkDir(path.fn_str(), mode); }
+#endif
+#endif // !__WXWINCE__
+
+#ifdef O_BINARY
+ #define wxO_BINARY O_BINARY
+#else
+ #define wxO_BINARY 0
+#endif