+ int pos;
+ const wxChar *pc;
+
+ // before trying to find an icon, grab mimetype information
+ // (because BFU's machine would hardly have well-edited mime.types but (s)he might
+ // have edited it in control panel...)
+
+ wxString mime_extension, mime_desc;
+
+ pos = wxNOT_FOUND;
+ if (wxGetLocale() != NULL)
+ mime_desc = _T("Comment[") + wxGetLocale()->GetName() + _T("]=");
+ if (pos == wxNOT_FOUND) mime_desc = _T("Comment=");
+ pos = text.Find(mime_desc);
+ if (pos == wxNOT_FOUND) mime_desc = wxEmptyString;
+ else
+ {
+ pc = text.c_str() + pos + mime_desc.Length();
+ mime_desc = wxEmptyString;
+ while ( *pc && *pc != _T('\n') ) mime_desc += *pc++;
+ }
+
+ pos = text.Find(_T("Patterns="));
+ if (pos != wxNOT_FOUND)
+ {
+ wxString exts;
+ pc = text.c_str() + pos + 9;
+ while ( *pc && *pc != _T('\n') ) exts += *pc++;
+ wxStringTokenizer tokenizer(exts, _T(";"));
+ wxString e;
+
+ while (tokenizer.HasMoreTokens())
+ {
+ e = tokenizer.GetNextToken();
+ if (e.Left(2) != _T("*.")) continue; // don't support too difficult patterns
+ mime_extension << e.Mid(2);
+ mime_extension << _T(' ');
+ }
+ mime_extension.RemoveLast();
+ }
+
+ ms_infoTypes.Add(mimetype);
+ ms_infoDescriptions.Add(mime_desc);
+ ms_infoExtensions.Add(mime_extension);
+
+ // ok, now we can take care of icon:
+
+ pos = text.Find(_T("Icon="));