X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..523050b607cfb5e6f9dfcb1544eb4f49ec1978cd:/src/common/filefn.cpp

diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 7cf2962bf7..947c3dfff7 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -99,7 +99,7 @@
 #endif
 
 #ifdef __WINDOWS__
-    #include "windows.h"
+    #include <windows.h>
 #endif
 
 // ----------------------------------------------------------------------------
@@ -745,10 +745,11 @@ wxPathOnly (wxChar *path)
         {
           done = TRUE;
 #ifdef __VMS__
-          buf[i+1] = 0;
-#else
+	   if ( path[i] == wxT(']') )
+	     buf[i+1] = 0;
+	   else
+#endif	     
           buf[i] = 0;
-#endif
 
           return buf;
         }
@@ -793,10 +794,11 @@ wxString wxPathOnly (const wxString& path)
         {
           done = TRUE;
 #ifdef __VMS__
-          buf[i+1] = 0;
-#else
+	   if ( path[i] == wxT(']') )
+	     buf[i+1] = 0;
+	   else
+#endif	     
           buf[i] = 0;
-#endif
 
           return wxString(buf);
         }
@@ -1057,7 +1059,7 @@ wxRenameFile (const wxString& file1, const wxString& file2)
 bool wxRemoveFile(const wxString& file)
 {
 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
-  int flag = wxRemove(wxFNSTRINGCAST file.fn_str());
+  int flag = wxRemove(file);
 #elif defined( __WXMAC__ )
   int flag = unlink(wxUnix2MacFilename( file ));
 #else
@@ -1176,9 +1178,15 @@ bool wxPathExists(const wxChar *pszPathName)
 #endif // __WINDOWS__
 
     wxStructStat st;
-
+#ifndef __VISAGECPP__
     return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 &&
         ((st.st_mode & S_IFMT) == S_IFDIR);
+#else
+    // S_IFMT not supported in VA compilers.. st_mode is a 2byte value only
+    return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 &&
+        (st.st_mode == S_IFDIR);
+#endif
+
 }
 
 // Get a temporary filename, opening and closing the file.
@@ -1255,7 +1263,10 @@ bool wxGetTempFileName(const wxString& prefix, wxString& buf)
 wxString wxFindFirstFile(const wxChar *spec, int flags)
 {
     wxString result;
-
+#ifdef __VMS
+   wxChar *specvms = NULL;
+#endif
+   
 #if !defined( __VMS__ ) || ( __VMS_VER >= 70000000 )
     if (gs_dirStream)
         closedir(gs_dirStream); // edz 941103: better housekeping
@@ -1270,11 +1281,29 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
 
     // special case: path is really "/"
     if ( !path && gs_strFileSpec[0u] == wxT('/') )
-        path = wxT('/');
-    // path is empty => Local directory
+#ifdef __VMS
+     {
+	wxStrcpy( specvms , wxT( "[000000]" ) );
+	gs_strFileSpec = specvms;
+	wxString path_vms(wxPathOnly(gs_strFileSpec));
+	path = path_vms;
+     }
+#else
+     path = wxT('/');
+#endif
+   // path is empty => Local directory
     if ( !path )
-        path = wxT('.');
-
+#ifdef __VMS
+     {
+	wxStrcpy( specvms , wxT( "[]" ) );
+	gs_strFileSpec = specvms;
+	wxString path_vms1(wxPathOnly(gs_strFileSpec));
+	path = path_vms1;
+     }
+#else
+     path = wxT('.');
+#endif
+   
     gs_dirStream = opendir(path.fn_str());
     if ( !gs_dirStream )
     {