[Lazarus] Function to get the mimetype from a file extension

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed May 9 17:09:56 CEST 2012



On Wed, 9 May 2012, Felipe Monteiro de Carvalho wrote:

> On Wed, May 9, 2012 at 4:15 PM,  <michael.vancanneyt at wisa.be> wrote:
>> Distribute a mime.types from a unix box with your app and load this in the
>> fpmimetypes unit using the provided function.
>> That's what I do on Windows. By far the easiest solution :)
>
> My code is the LCL, so I cannot do that without forcing all
> LCL-CustomDrawn-Android users to deploy this file. I think I will
> steal the code from TurboPower iPro and put it somewhere in LazUtils.

On windows it looks in the registry. Good luck with that on Android :-)

For other OSes there are about 4 or 5 mime types defined. Not really useful.

So my suggestion is probably still the best. I don't see why you'd need to
force this on all users, only the ones that need mime types need the file ?

Or you could convert it to an include file that just registers all more or
less known types in fpmimetypes.pp. Then people can include this include
file and be done with it.

Michael.




More information about the Lazarus mailing list