basedir spec

Jaap Karssenberg j.g.karssenberg at student.utwente.nl
Thu Sep 4 13:51:36 EEST 2003


On Thu, 4 Sep 2003 10:07:47 +0530 Biju Chacko wrote:
: And what would an empty var mean? Logically, an application cannot
: look for a datafile in the path "", so it would have to fall back to a
: default -- which is what the standard states.
: 
: Since this is fairly obvious, I guess you must have somehing else in
: mind. Could you clarify please?

Thank you for your confidence :)

Following the spec both 'XDG_DATA_HOME' and 'XDG_DATA_DIRS' are searched
by some app. Now if I want to force the app to search just _one_ dir I
set 'XDG_DATA_HOME' to that directory, now my dir _and_ the default dirs
for 'XDG_DATA_DIRS' are searched. If I could set 'XDG_DATA_DIRS' to an
empty string, I would be sure only my dir is searched, but the spec
prohibits this by specifying that the default should also be used for
"set but empty" vars.

Setting the search path to just one dir is very usefull for testing
purposes. Also it is not unthinkable that a user _only_ wants to use his
own data dir, and non of the defaults provided by the admin.

Real life example:
I ship a test script with the File::MimeInfo module to CPAN, CPAN has a
group of testers that compile a lot of new modules, so including scripts
for "make test" is almost mandatory (also it provides valuable
feed-back). In order to have a controlled environment I also ship a
magic file with it. Now I want to make sure _only_ this magic file is
used, and no other versions that might be installed on the system. Now
the mime-info spec specifies that _all_ the basedirs should be searched
and used, thus I need to set the environment so that my test dir is the
only basedir searched. Currently to force this behaviour I have to set
both 'XDG_DATA_HOME' and 'XDG_DATA_DIRS' to my dir and then anticipate
the same magic file being read twice - which of course is a dirty hack.


-- 
   )   (       Jaap Karssenberg || Pardus [Larus]
   :   :       http://pardus-larus.student.utwente.nl/~pardus
 )  \ /  (    
 ",.*'*.,"     " Where computers are concerned _always_ be paranoid "



More information about the xdg mailing list