Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / common / mime.cpp
1 #include <wx/wx.h>
3 wxString GetMIME(wxString FilenameInc){
5         wxString MIMEResult;
7 #ifdef __WIN32__
9 #include <urlmon.h>
11         /*char *;
12         unsigned long Buffersize;
13         FindMimeFromData(NULL, NULL, , , NULL, FMFD_DEFAULT, , 0);*/
15 #else
17 #include <magic.h>
19         const char *MIMEType;
20         magic_t MagicCookie = magic_open(MAGIC_MIME);
21         magic_setflags(MagicCookie, MAGIC_MIME_TYPE);
23         if (!MagicCookie){
25                 wxMessageBox(_("An error occured with the support library for getting the picture/audio type."), _("Error opening picture/audio file"), wxICON_ERROR);
26                 return;
28         }
30         if (magic_load(MagicCookie, NULL) != 0) {
32                 wxMessageBox(_("An error occured whilst determining the picture/audio type."), _("Error opening picture/audio file"), wxICON_ERROR);
33                 return;
35         }
37         MIMEType = magic_file(MagicCookie, FilenameInc.mb_str());
38         MIMEResult = wxString::FromUTF8(MIMEType);
39         magic_close(MagicCookie);
41 #endif
43         return MIMEResult;
45 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy