]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
Moved allocation of m_imData or key down gives seg fault
[wxWidgets.git] / src / common / filefn.cpp
index 55aa0e7ce8c0087363560901ac11d663278a5f47..18620e0a5cbcb8c89561663b51141b0afd55d498 100644 (file)
@@ -183,14 +183,14 @@ void wxPathList::AddEnvList (const wxString& envVariable)
         path such as "C:\Program Files" would be split into 2 paths:
         "C:\Program" and "Files"
         */
-//        wxT(" ;"); // Don't seperate with colon in DOS (used for drive)
-        wxT(";"); // Don't seperate with colon in DOS (used for drive)
+//        wxT(" ;"); // Don't separate with colon in DOS (used for drive)
+        wxT(";"); // Don't separate with colon in DOS (used for drive)
 #else
         wxT(" :;");
 #endif
 
-    wxChar *val = wxGetenv (WXSTRINGCAST envVariable);
-    if (val && *val)
+    wxString val ;    
+    if (wxGetEnv (WXSTRINGCAST envVariable, &val))
     {
         wxChar *s = MYcopystring (val);
         wxChar *save_ptr, *token = wxStrtok (s, PATH_TOKS, &save_ptr);
@@ -1011,12 +1011,12 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
         return false;
     }
 #elif defined(__OS2__)
-    if ( ::DosCopy(file2, file2, overwrite ? DCPY_EXISTING : 0) != 0 )
+    if ( ::DosCopy((PSZ)file1.c_str(), (PSZ)file2.c_str(), overwrite ? DCPY_EXISTING : 0) != 0 )
         return false;
 #elif defined(__PALMOS__)
     // TODO with http://www.palmos.com/dev/support/docs/protein_books/Memory_Databases_Files/
     return false;
-#else // !Win32
+#elif wxUSE_FILE // !Win32
 
     wxStructStat fbuf;
     // get permissions of file1
@@ -1087,6 +1087,15 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
         return false;
     }
 #endif // OS/2 || Mac
+
+#else // !Win32 && ! wxUSE_FILE
+
+    // impossible to simulate with wxWidgets API
+    wxUnusedVar(file1);
+    wxUnusedVar(file2);
+    wxUnusedVar(overwrite);
+    return false;
+
 #endif // __WXMSW__ && __WIN32__
 
     return true;
@@ -1195,7 +1204,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
 }
 
 // does the path exists? (may have or not '/' or '\\' at the end)
-bool wxPathExists(const wxChar *pszPathName)
+bool wxDirExists(const wxChar *pszPathName)
 {
     wxString strPath(pszPathName);
 
@@ -1227,7 +1236,7 @@ bool wxPathExists(const wxChar *pszPathName)
 
     return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY);
 #elif defined(__OS2__)
-    return (::DosSetCurrentDir(WXSTRINGCAST strPath));
+    return (::DosSetCurrentDir((PSZ)(WXSTRINGCAST strPath)));
 #else // !__WIN32__
 
     wxStructStat st;
@@ -1256,6 +1265,8 @@ wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
 
     return buf;
 #else
+    wxUnusedVar(prefix);
+    wxUnusedVar(buf);
     // wxFileName::CreateTempFileName needs wxFile class enabled
     return NULL;
 #endif
@@ -1954,12 +1965,14 @@ wxFileKind wxGetFileKind(int fd)
 
 wxFileKind wxGetFileKind(FILE *fp)
 {
-    // note: the watcom rtl dll doesn't have fileno (the static lib does)
-#if !defined wxFILEKIND_STUB && !(defined __WATCOMC__ && defined __SW_BR)
-    return wxGetFileKind(fileno(fp));
-#else
+    // Note: The watcom rtl dll doesn't have fileno (the static lib does).
+    //       Should be fixed in version 1.4.
+#if defined(wxFILEKIND_STUB) || \
+        (defined(__WATCOMC__) && __WATCOMC__ <= 1230 && defined(__SW_BR))
     (void)fp;
     return wxFILE_KIND_DISK;
+#else
+    return wxGetFileKind(fileno(fp));
 #endif
 }