Re: Need help with mime types & file associations



On Fri, 2006-09-08 at 10:56 -0400, Joshua Smith wrote:
> Nautilus Guri,
> 
> First, the caveats: I REALLY REALLY tried to figure this out myself, 
> and found lots of thoroughly unhelpful hints on the web.  I tried to 
> look in the Gnome FAQ Wiki, but the web server said "permission 
> denied", and I tried to search the archive of this mailing list, but 
> that is broken too.  If there is a better place to post this question, 
> please let me know.
> 
> Problem Summary:
> 
> I am trying to configure an installer for my software, such that when 
> the user tries to open a file with a particular extension, my program 
> runs and is given that file as it's argument.  (On Windows, I do this 
> through a bunch of cryptic registry entries; on the Mac, I put some 
> voodoo into an Info.plist file.)
> 
> Details:
> 
> 1. My file format is really ZIP/JAR with a different extension, just 
> like OpenOffice docs.
> 2. I need this to work with Sun JDS, which uses some version of Gnome 
> and version 2.6.0 of Nautilus.  (I don't know how to find out what 
> version of Gnome is running.)
> 3. The desktop is ABSOLUTELY CONVINCED that my files are mime type 
> application/zip
> 4. I'm very comfortable with Unix, dating back decades, but I have no 
> experience whatsoever with modern Unix GUIs
> 
> What I think I know:
> 
> A) I need to convince the desktop that files ending in .mesonjar are 
> mime type application/x-meson
> B) I need to convince the desktop to open application/x-meson files 
> using my program
> 
> I'm mostly focused on A, since B seems to be pretty well documented 
> (.desktop files seem to be the key), and I have to get A done before I 
> can start to think about getting B right.
> 
> I read the man page on mime magic, which says that file sniffing is 
> going to take priority over anything else I do.  That looked bad until 
> I looked at the magic file, and found the line for ZIP is commented out 
> because it would keep StarOffice from recognizing its own files 
> (according to a comment).  This does leave me quite mystified as to how 
> it knows my files are really ZIPs... is there something else that does 
> the same thing as /etc/gnome-vfs-mime-magic?

This is a bit tricky, as the mime type handling has changed over the
years. If you were using the most recent code adding a shared-mime-info
xml snippet and running update-mime-database would be enough, because
gnome-vfs always prefers the extension magic over sniffing for files
that sniff as zip files these days (for this specific reason).

However, since you don't really know what version of gnome you're using
its a bit tricky. Not to mention that I don't remember in what versions
we changed what exactly.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a gun-slinging playboy romance novelist who hides his scarred face behind 
a mask. She's a supernatural belly-dancing journalist with the soul of a 
mighty warrior. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]