From 1ee17e1c421b64b3a356fee82f454ab4b43ab50c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Jan 1999 12:47:04 +0000 Subject: [PATCH] wxMimeTypesManagerImpl::GetFileTypeFromMimeType() implemented git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/mimetype.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 1e268d586d..513c35b3fc 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -796,8 +796,25 @@ wxMimeTypesManagerImpl::wxMimeTypesManagerImpl() wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) { - wxFAIL_MSG("not implemented (must parse mime.types)"); + size_t count = m_aExtensions.GetCount(); + for ( size_t n = 0; n < count; n++ ) { + wxString extensions = m_aExtensions[n]; + while ( !extensions.IsEmpty() ) { + wxString field = extensions.BeforeFirst(' '); + extensions = extensions.AfterFirst(' '); + + // consider extensions as not being case-sensitive + if ( field.IsSameAs(ext, FALSE /* no case */) ) { + // found + wxFileType *fileType = new wxFileType; + fileType->m_impl->Init(this, n); + + return fileType; + } + } + } + // not found return NULL; } -- 2.45.2