X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cb9c71eccaf7b33d2f427c37ba5902f9a9ffdc29..d34cca534cde8acf4406c0276ad6b5f76e7b1ce7:/src/mac/carbon/mimetmac.cpp diff --git a/src/mac/carbon/mimetmac.cpp b/src/mac/carbon/mimetmac.cpp index f9cfb58d97..634c70065c 100644 --- a/src/mac/carbon/mimetmac.cpp +++ b/src/mac/carbon/mimetmac.cpp @@ -26,10 +26,6 @@ // // -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "mimetype.h" -#endif - // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -58,8 +54,10 @@ // other standard headers #include -#include //For mime types +#ifndef __DARWIN__ +#include //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 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(" {"); @@ -1213,7 +1212,7 @@ public: int GetValue() { int nOut; - CFNumberGetValue( m_cfnRef, + CFNumberGetValue( m_cfnRef, kCFNumberIntType, &nOut ); @@ -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; @@ -1462,7 +1461,7 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) wxCFDictionary cfdInfo; bool bInfoOpenSuccess = false; wxFile indictfile; - if(indictfile.Open(sInfoPath, wxFile::read)); + if(indictfile.Open(sInfoPath, wxFile::read)) { CFIndex cfiBufLen = (CFIndex) indictfile.Length(); const UInt8* pBuffer = new UInt8[cfiBufLen]; @@ -1805,7 +1804,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType) wxCFDictionary cfdInfo; bool bInfoOpenSuccess = false; wxFile indictfile; - if(indictfile.Open(sInfoPath, wxFile::read)); + if(indictfile.Open(sInfoPath, wxFile::read)) { CFIndex cfiBufLen = (CFIndex) indictfile.Length(); const UInt8* pBuffer = new UInt8[cfiBufLen]; @@ -2006,4 +2005,4 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType) CFWriteStreamClose(cfwsInfo); */ -#endif //wxUSE_MIMETYPE \ No newline at end of file +#endif //wxUSE_MIMETYPE