/////////////////////////////////////////////////////////////////////////////
-// Name: mac/mimetype.cpp
+// Name: src/mac/carbon/mimetype.cpp
// Purpose: Mac Carbon implementation for wx MIME-related classes
// Author: Ryan Norton
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+ #pragma hdrstop
#endif
-#ifndef WX_PRECOMP
- #include "wx/string.h"
-
- #if wxUSE_GUI
- #include "wx/icon.h"
- #endif
-#endif
+#if wxUSE_MIMETYPE
+#include "wx/mac/mimetype.h"
-#if wxUSE_MIMETYPE
+#ifndef WX_PRECOMP
+ #include "wx/dynarray.h"
+ #include "wx/string.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
+
+ #if wxUSE_GUI
+ #include "wx/icon.h"
+ #endif
+#endif
-#include "wx/log.h"
#include "wx/file.h"
-#include "wx/intl.h"
-#include "wx/dynarray.h"
#include "wx/confbase.h"
-#include "wx/mac/mimetype.h"
#include "wx/mac/private.h"
// other standard headers
#ifndef __DARWIN__
#include <InternetConfig.h>
+ #include <CoreServices.h>
#endif
-
+#ifndef __LP64__
// START CODE SAMPLE FROM TECHNOTE 1002 (http://developer.apple.com/technotes/tn/tn1002.html)
// IsRemoteVolume can be used to find out if the
return result;
}
-
+#endif
//
// On the mac there are two ways to open a file - one is through apple events and the
// finder, another is through mime types.
m_lIndex, &entry);
wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension);
- sCurrentExtension = sCurrentExtension.Right(sCurrentExtension.Length()-1 );
+ sCurrentExtension = sCurrentExtension.Right(sCurrentExtension.length()-1 );
//type, creator, ext, roles, outapp (FSRef), outappurl
CFURLRef cfurlAppPath;
#else //carbon/classic implementation
+
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
//entry has period in it
wxString sCurrentExtension = wxMacMakeStringFromPascal( entry.extension );
- extensions.Add( sCurrentExtension.Right( sCurrentExtension.Length() - 1 ) );
+ extensions.Add( sCurrentExtension.Right( sCurrentExtension.length() - 1 ) );
return true;
}
if (status != noErr)
{
wxLogDebug(wxT("Could not initialize wxMimeTypesManager!"));
- wxASSERT( false );
+ wxFAIL;
m_hIC = NULL;
return;
if (status == noErr)
{
wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension);
- if ( sCurrentExtension.Right(sCurrentExtension.Length() - 1) == e ) // entry has period in it
+ if ( sCurrentExtension.Right(sCurrentExtension.length() - 1) == e ) // entry has period in it
{
wxFileType* pFileType = new wxFileType();
pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos);
infoRec.processInfoLength = sizeof(ProcessInfoRec);
infoRec.processName = NULL;
+#ifndef __LP64__
infoRec.processAppSpec = NULL;
+#endif
if ( pPSN == NULL )
{
//
#include "wx/mac/corefoundation/cfstring.h"
-#include "wx/intl.h" //wxLocale for wxCFString
#define wxCF_RELEASE true
#define wxCF_RETAIN false
// ----------------------------------------------------------------------------
#define wxCFDATA_RELEASEBUFFER 1
-#define wxCFDATA_RETAINBUFFER 0
class wxCFData
{
//'*' for unrestricted
if (ftInfo.GetExtensionsCount() != 0)
{
- for (size_t iExtension = 0; iExtension < (size_t)ftInfo.GetExtensionsCount(); ++iExtension)
+ for (size_t iExtension = 0; iExtension < ftInfo.GetExtensionsCount(); ++iExtension)
{
cfaExtensions.Add( wxCFString( asExtensions[iExtension] ) );
}
if (status == noErr)
{
Str255 psCreatorName;
+#ifndef __LP64__
FSSpec dummySpec;
status = FindApplication(creator, false, psCreatorName, &dummySpec);
+#else
+ FSRef fsref;
+ status = LSFindApplicationForInfo( creator, NULL, NULL, &fsref ,NULL);
+ HFSUniStr255 name;
+ status = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, &name, NULL, NULL);
+ CFStringRef str = FSCreateStringFromHFSUniStr( 0 , &name );
+ CFStringGetPascalString(str, psCreatorName, 256, CFStringGetSystemEncoding());
+ CFRelease( str );
+#endif
if (status == noErr)
{
wxMacStringToPascal(ftInfo.GetDescription(), psDescription);
Str255 psPostCreatorName;
- wxMacStringToPascal(wxT(""), psPostCreatorName);
+ wxMacStringToPascal(wxEmptyString, psPostCreatorName);
//add the entry to the database
ICMapEntry entry;