]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filename.cpp
applied patch for safer GIF decoding (502103)
[wxWidgets.git] / src / common / filename.cpp
index 086750834279f7e5f1887b43c764ad252f90a038..5c2f9b007c215bf932e347a4b0ae148284138c41 100644 (file)
 #include "wx/msw/winundef.h"
 #endif
 
+#if defined(__WXMAC__)
+  #include  "wx/mac/private.h"  // includes mac headers
+#endif
+
 // utime() is POSIX so should normally be available on all Unices
 #ifdef __UNIX_LIKE__
 #include <sys/types.h>
@@ -537,8 +541,11 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
 #else // !Windows, !OS/2
     if ( dir.empty() )
     {
+#if defined(__WXMAC__) && !defined(__DARWIN__)
+        dir = wxMacFindFolder(  (short) kOnSystemDisk, pTemporaryFolder, kCreateFolder ) ;
+#else // !Mac
         dir = wxGetenv(_T("TMP"));
-        if ( path.empty() )
+        if ( dir.empty() )
         {
             dir = wxGetenv(_T("TEMP"));
         }
@@ -547,11 +554,12 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
         {
             // default
             #ifdef __DOS__
-            dir = _T(".");
+                dir = _T(".");
             #else
-            dir = _T("/tmp");
+                dir = _T("/tmp");
             #endif
         }
+#endif // Mac/!Mac
     }
 
     path = dir;
@@ -1265,19 +1273,17 @@ wxString wxFileName::GetLongPath() const
     if ( !s_triedToLoad )
     {
         s_triedToLoad = TRUE;
-        wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
-        if ( dllKernel )
+        wxDynamicLibrary dllKernel(_T("kernel32"));
+        if ( dllKernel.IsLoaded() )
         {
             // may succeed or fail depending on the Windows version
             static GET_LONG_PATH_NAME s_pfnGetLongPathName = NULL;
 #ifdef _UNICODE
-            s_pfnGetLongPathName = (GET_LONG_PATH_NAME) wxDllLoader::GetSymbol(dllKernel, _T("GetLongPathNameW"));
+            s_pfnGetLongPathName = (GET_LONG_PATH_NAME) dllKernel.GetSymbol(_T("GetLongPathNameW"));
 #else
-            s_pfnGetLongPathName = (GET_LONG_PATH_NAME) wxDllLoader::GetSymbol(dllKernel, _T("GetLongPathNameA"));
+            s_pfnGetLongPathName = (GET_LONG_PATH_NAME) dllKernel.GetSymbol(_T("GetLongPathNameA"));
 #endif
 
-            wxDllLoader::UnloadLibrary(dllKernel);
-
             if ( s_pfnGetLongPathName )
             {
                 DWORD dwSize = (*s_pfnGetLongPathName)(path, NULL, 0);