Request for clarification on menu/file spec

Lubos Lunak l.lunak at suse.cz
Wed Feb 8 14:18:38 EET 2006


On Tuesday 07 February 2006 18:18, Jeremy White wrote:
> > rather pragmatic approach so if it was up to me to implement xdg
> > support into loki-setup I'd just try to put a desktop file into
> > /usr/share/applications if it already exists. If that fails, try
> > $XDG_DATA_DIRS and finally create ~/.local/share/applications. The
> > uid of the user you are running as doesn't matter.
>
> Yep.  The whole problem is when you say 'try $XDG_DATA_DIRS', what
> exactly does that mean?  I'm trying to write a single .desktop file;
> do I write it to every directory listed in $XDG_DATA_DIRS?  Do I write
> it just to the first directory, or do I (my personal favorite) write
> it to the first writable directory in the list?

 No, the point you fail to see is that 'datadir' is not a directory. It's a 
list of directories that's searched. So "try $XDG_DATA_DIRS" means "put it in 
any dir listed in $XDG_DATA_DIRS". If in KDE I say "it belongs in 
$KDEDIRS/share", then if $KDEDIRS is /usr:/opt/kde3, then it belongs either 
in /usr/share or /opt/kde3/share (or also $KDEHOME/share, as that's the 
user's local data).

 As for the actual problem of where to put things, the two solutions and their 
problems are:

- extend $XDG_DATA_DIRS to include /opt/whatever and keep everything 
under /opt/whatever. The problem here is with modifying $XDG_DATA_DIRS and 
there's also very likely a performance problem - having to scan a dozen of 
directories for every file doesn't sound like a good idea.

- put relevant files in $XDG_DATA_DIRS (or the user's local directory if it's 
not a root install). The problem here is that the files are not 
in /opt/whatever.

 How about using a solution that'd merge these two? Let's say that everything 
will be put in /opt/whatever, but the relevant files will also have symlinks 
from $XDG_DATA_DIRS (/usr/local preferably). There would be no need to modify 
$XDG_DATA_DIRS. There shouldn't be any bad performance impact because of it. 
Everything will be in /opt/whatever and cleaning of things added to 
$XDG_DATA_DIRS would be just a matter of scanning it for invalid symlinks and 
dumping those.

 Can anybody see a problem here?

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/



More information about the xdg mailing list