]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/mimetype.cpp
Fixed filename in wxOSX-Cocoa's file dialog using extension of wrong file type.
[wxWidgets.git] / src / unix / mimetype.cpp
index 05426d667ae373c2f025b9f9a19c7586abd1b837..caa9459875e990a4b8bfa67a1fb482553792b521 100644 (file)
@@ -507,14 +507,19 @@ void wxMimeTypesManagerImpl::InitIfNeeded()
         // set the flag first to prevent recursion
         m_initialized = true;
 
-        wxString wm = wxTheApp->GetTraits()->GetDesktopEnvironment();
+        int mailcapStyles = wxMAILCAP_ALL;
+        if ( wxAppTraits * const traits = wxApp::GetTraitsIfExists() )
+        {
+            wxString wm = traits->GetDesktopEnvironment();
 
-        if (wm == wxT("KDE"))
-            Initialize( wxMAILCAP_KDE  );
-        else if (wm == wxT("GNOME"))
-            Initialize( wxMAILCAP_GNOME );
-        else
-            Initialize();
+            if ( wm == "KDE" )
+                mailcapStyles = wxMAILCAP_KDE;
+            else if ( wm == "GNOME" )
+                mailcapStyles = wxMAILCAP_GNOME;
+            //else: unknown, use the default
+        }
+
+        Initialize(mailcapStyles);
     }
 }