(no subject)

Mike Hearn mike at plan99.net
Fri Apr 14 01:00:37 EEST 2006


On Thu, 13 Apr 2006 16:14:19 +0530, nupul kukreja wrote:
> Well Luca thanks  a million....yup it did help me solve my doubt...

I'm afraid that won't work. Multiple applications can handle the same file
types, and then the user can choose between them in their file manager or
select a default.

Information on which the default is ISN'T provided by any standard or
specified mechanism, deliberately! The problem is, if you can read this
data you can really write to it too, and on Windows there have always been
problems with programs fighting over file associations. So Linux uses a
different scheme, in which the defaults are a desktop private thing and
apps can't control that. All they can do is say "I support files of type
foo".

So, to actually open a file from your application requires you to use
gnome/kde specific APIs right now :( Sad I know but you can see how we got
here. The Portland project is working on an abstraction layer that will
provide a unified API to all this. Go Portland!

For now try gnome-open or kfmclient.

> eg. Say my software uses a custom format .asdf files. Do I need to
> update the mimeinfo.cache as well as add my .desktop file to this
> folder?

No, drop it in the right place and run update-desktop-database.

Of course if you have defined your own .asdf files, you need a custom asdf
mime type and a way to detect these files ... preferably by their contents
but extensions are OK too. So you'll need to write an XML file for your
file type, drop it in the right place then run update-mime-database too :)

> If you search for .desktop files on your system you'll find a lot more
> than those in the above directory. Why is this?

They're used for all kinds of things, not just registering programs with
the system. A historical oddity, ignore it.

thanks -mike




More information about the xdg mailing list