-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)
+{
+ struct stat st;
+#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 !access(fname, 0) &&
+ !stat(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 !access(name, 0) &&
+ !stat((wxChar*) 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 access(wxFNCONV(name), how) == 0;