ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Sietse Brouwer <sbbrouwer@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: System variable HOME
Date: Mon, 5 Nov 2012 00:15:17 +0100	[thread overview]
Message-ID: <CAF=dkzyCnGtNtrrQh7LfLqgTHDwBSMgQ91cvKWfEY5XZmC1S4A@mail.gmail.com> (raw)
In-Reply-To: <op.wm5mpqhhtpjj8f@lpr>

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
___________________________________________________________________________________

  parent reply	other threads:[~2012-11-04 23:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02 16:28 Procházka Lukáš Ing. - Pontex s. r. o.
2012-11-03 11:43 ` Sietse Brouwer
2012-11-03 20:47   ` Procházka Lukáš
2012-11-04 23:15 ` Sietse Brouwer [this message]
2012-11-05  8:15   ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-11-05 17:46   ` Hans Hagen
2012-11-09 17:28     ` Sietse Brouwer
2012-11-19  8:16     ` Procházka Lukáš Ing. - Pontex s. r. o.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF=dkzyCnGtNtrrQh7LfLqgTHDwBSMgQ91cvKWfEY5XZmC1S4A@mail.gmail.com' \
    --to=sbbrouwer@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).