Small problem with XDG_DATA_DIRS and XDG_CONFIG_DIRS

Thiago Macieira thiago at kde.org
Thu Jan 26 11:37:10 EET 2006


Behdad Esfahbod wrote:
>> But this can't be done with XDG_*_DIRS, since as soon as you set
>> it, you are losing the default values.  So for a couple months
>> I've been doing:
>>
>>   export XDG_DATA_DIRS="$PREFIX/share:$XDG_DATA_DIRS"
>>
>> And wondering why my menus are lost!
>>
>> I can think of one solution, but it has its own problem:  Treat
>> any empty component of the list as the default values.  Then
>> for example "/opt/share:" means "/opt/share" followed by the
>> default list.

Another solution is to fix the script.

According to 
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html, the 
default values are well defined.

So, instead of just doing:
export XDG_DATA_DIRS="$PREFIX/share:$XDG_DATA_DIRS"

You could do add the default:
XDG_DATA_DIRS="$PREFIX/share:"${XDG_DATA_DIRS-/usr/local/share/:/usr/share/}

Testing it:
$ echo $XDG_DATA_DIRS

$ 
XDG_DATA_DIRS="$KDEDIR/share:"${XDG_DATA_DIRS-/usr/local/share/:/usr/share/}
$ echo $XDG_DATA_DIRS
/usr/local/kde3-r500000//share:/usr/local/share/:/usr/share/

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

1. On frumscafte, hwonne time_t wæs náht, se scieppend þone circolwyrde 
wundorcræftlíge cennede and seo eorðe wæs idel and hit wæs gód.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xdg/attachments/20060126/d5a4ba2b/attachment.pgp 


More information about the xdg mailing list