-bool wxFile::Exists(const char *sz)
-{
- struct stat st;
- return !access(sz, 0) && !stat(sz, &st) && (st.st_mode & S_IFREG);
+bool wxFile::Exists(const wxChar *name)
+{
+ wxStructStat st;
+#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)
+{
+ int how = 0;
+
+ switch ( mode ) {
+ case read:
+ how = R_OK;
+ break;
+
+ case write:
+ how = W_OK;
+ break;
+
+ default:
+ wxFAIL_MSG(wxT("bad wxFile::Access mode parameter."));
+ }
+
+ return wxAccess(wxFNCONV(name), how) == 0;