Lukáš wrote:
> it seems that Ctx [re]defines the system variable HOME on its run

Did some digging, and indeed it does. This is what happens, if I read
the code correctly (lines 11681-11696 of context/bin/mtxrun):
* `homedir` is read from the environment variable USERPROFILE on
Windows, and from HOME on Linux.
* both USERPROFILE and HOME (and environment.homedir) are then set to
the value of `homedir`.

Questions this raises:

(1) Windows does not seem to use HOME (it's not in any of the lists of
environment variables that I found), only HOMEDRIVE and HOMEPATH, so
what do you use it for?

(2) why would mtxrun set the variables and risk overwriting something?
The comments suggest it is for the benefit of the cnf files, but still
--- why overwrite?
    ossetenv("HOME",       homedir) -- can be used in unix cnf files
    ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files

(3) What is the 'correct' thing to do here? Should HOME be the same as
USERPROFILE? Should you not be using HOME? Should mtxrun not be
overwriting HOME?

My knowledge ends here --- anyone know any answers to any questions?

Cheers and good luck,
Sietse

Below: relevant code from mtxrun, lines 11681-11696

    local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or
'HOME') or ''

    if not homedir or homedir == "" then
        homedir = char(127) -- we need a value, later we wil trigger on it
    end

    homedir = file.collapsepath(homedir)

    ossetenv("HOME",       homedir) -- can be used in unix cnf files
    ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files

    environment.homedir = homedir
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to