Finding an icon for a file in Linux

Hi,

I am writing a file manager and am looking for the best way to get the
icon for a file type. I am assuming it uses mimetypes, but I haven’t
found a good solution yet. If anyone could point me in the right
direction I’d appreciate it.

Thanks.

Riccardo Cecolin wrote:

John B. wrote:

Hi,

I am writing a file manager and am looking for the best way to get the
icon for a file type. I am assuming it uses mimetypes, but I haven’t
found a good solution yet. If anyone could point me in the right
direction I’d appreciate it.

Thanks.

You could parse output of “file” command:
file (command) - Wikipedia
http://en.wikipedia.org/wiki/File_(command)

As far as I can tell, that will only tell me the mimetype. My main
problem really is that I can’t take the mimetype and use it to find the
icon file. I already found the gem that will determine the mimetype.
(http://mime-types.rubyforge.org/)

John B. wrote:

Hi,

I am writing a file manager and am looking for the best way to get the
icon for a file type. I am assuming it uses mimetypes, but I haven’t
found a good solution yet. If anyone could point me in the right
direction I’d appreciate it.

Thanks.

You could parse output of “file” command:

http://en.wikipedia.org/wiki/File_(command)