Small problem with XDG_DATA_DIRS and XDG_CONFIG_DIRS
Behdad Esfahbod
behdad at cs.toronto.edu
Sat Mar 19 02:18:53 EET 2005
Hi,
The current spec by falling back on some const values when the
XDG_*_DIRS are not set or are empty, prevents one from prepending
(or appending) directories to them easily. In other words, for
example, when I want to compile some applications under /opt, I
would put something like this in my .bashrc:
PREFIX=/opt
export PATH="$PREFIX/bin:$PATH"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I$PREFIX/include $CPPFLAGS"
export CFLAGS="-I$PREFIX/include $CFLAGS"
export CXXFLAGS="-I$PREFIX/include $CXXFLAGS"
export LDFLAGS="-L$PREFIX/lib $LDFLAGS"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export MANPATH="$PREFIX/man:$MANPATH"
export PYTHONPATH="$PREFIX/lib/python:$PREFIX/lib/python2.3/site-packages:$PYTHONPATH"
export PERL5LIB="$PREFIX/lib/perl5/site_perl:$PERL5LIB"
export CLASSPATH=".:$PREFIX/lib/java:$CLASSPATH"
export ACLOCAL_FLAGS="-I $PREFIX/share/aclocal $ACLOCAL_FLAGS"
export ACLOCAL_AMFLAGS="-I $PREFIX/share/aclocal $ACLOCAL_AMFLAGS"
...
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.
Perhaps not the biggest problem and not the best solution, but
worth discussion IMHO.
--behdad
More information about the xdg
mailing list