]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/mimetmac.cpp
patch 1306473
[wxWidgets.git] / src / mac / carbon / mimetmac.cpp
index 5516810999446ec809db52a26c5e0482ea98ce4c..634c70065c8c01028caaa55f0a963b88bffcda79 100644 (file)
 //
 //
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "mimetype.h"
-#endif
-
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 
 // other standard headers
 #include <ctype.h>
-#include <InternetConfig.h> //For mime types
 
+#ifndef __DARWIN__
+#include <InternetConfig.h> //For mime types
+#endif
 
 /*   START CODE SAMPLE FROM TECHNOTE 1002 (http://developer.apple.com/technotes/tn/tn1002.html) */
 
@@ -389,7 +387,7 @@ wxFileTypeImpl::GetPrintCommand(wxString *printCmd,
 #if defined(__DARWIN__)
 
 //on darwin, use launch services
-#include "LaunchServices.h"
+#include <ApplicationServices/ApplicationServices.h>
 
 wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
 {
@@ -420,8 +418,9 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
             CFRelease(cfurlAppPath);
 
             //PHEW!  Success!
+            //Since a filename might have spaces in it, so surround it with quotes
             if(cfsUnixPath)
-                return wxMacCFStringHolder(cfsUnixPath).AsString(wxLocale::GetSystemEncoding());
+                return wxString(wxT("'")) + wxMacCFStringHolder(cfsUnixPath).AsString(wxLocale::GetSystemEncoding()) + wxString(wxT("'"));
         }
         else
         {
@@ -906,7 +905,7 @@ public:
     bool Exists(CFTypeRef cftKey) const
     {
         wxASSERT(IsValid());
-        return CFDictionaryContainsKey((CFDictionaryRef)m_cfmdRef, cftKey) == true;
+        return CFDictionaryContainsKey((CFDictionaryRef)m_cfmdRef, cftKey);
     }
 
     bool IsOk() const {return m_cfmdRef != NULL; }
@@ -970,7 +969,7 @@ public:
         }
     }
 
-    static void PrintOutType(wxString& sMessage, wxString sValue, CFTypeRef cfRef)
+    static void PrintOutType(wxString& sMessage, const wxString& sValue, CFTypeRef cfRef)
     {
             sMessage << wxT(" {");
 
@@ -1359,9 +1358,9 @@ void wxCFDictionary::MakeValidXML()
                 cfdCurrent.MakeValidXML();
                 Set(pKeys[i], cfdCurrent);
             }
-            else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
-                       CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
-                       CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
+            else if ( CFGetTypeID(cfRef) != CFStringGetTypeID() &&
+                      CFGetTypeID(cfRef) != CFNumberGetTypeID() &&
+                      CFGetTypeID(cfRef) != CFBooleanGetTypeID() )
             {
                 Remove(pKeys[i]);
                 --i;
@@ -1406,9 +1405,9 @@ void wxCFArray::MakeValidXML()
                 cfdCurrent.MakeValidXML();
                 Set(i, cfdCurrent);
             }
-            else if( ( CFGetTypeID(cfRef) == CFStringGetTypeID() ||
-                       CFGetTypeID(cfRef) == CFNumberGetTypeID() ||
-                       CFGetTypeID(cfRef) == CFBooleanGetTypeID() ) == false )
+            else if ( CFGetTypeID(cfRef) != CFStringGetTypeID() &&
+                      CFGetTypeID(cfRef) != CFNumberGetTypeID() &&
+                      CFGetTypeID(cfRef) != CFBooleanGetTypeID() )
             {
                 Remove(i);
                 --i;
@@ -2006,4 +2005,4 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
                             CFWriteStreamClose(cfwsInfo);
 
 */
-#endif //wxUSE_MIMETYPE
\ No newline at end of file
+#endif //wxUSE_MIMETYPE