Hi Steve,
    You are right. I searched for get-env and looked in released rather than latest documentation and I missed the fact that GET-ENV exists. And yes, I mistakenly referred to it at GETENV in a comment. The latest documentation in my sources is:

        (get-env name) - get from an environment variable
           name - the name (string or symbol) of the environment variable
           returns  - string value of the environment variable, nil if variable does not exist

I didn't check the Audacity sources, but it looks like version 1.3.12 does not have GET-ENV, but version 1.3.13 does. If you want to check sources, try this:
    cd audacity-src/lib-src/libnyquist/xlisp
    grep xget_env *
This prints:

xlftab.c:    xget_env(void), xload(void),xtranscript(void),
xlftab.c:{       "GET-ENV",                      S, xget_env             }, /* 308 */
xlisp.h:LVAL xget_env(void);
xlsys.c:/* xget_env - get the value of an environment variable */
xlsys.c:LVAL xget_env(void)

The key line is #2 (puts GET-ENV in the XLISP interpreters list of built-in functions). That line references xget_env, so if that line compiles and links, then xget_env (the actual implementation) is included, and it is accessible as GET-ENV in XLISP code.

This is in the latest Audacity sources.


On 10/21/10 8:25 AM, Stevethefiddle wrote:
Thanks Roger.
There's a parallel discussion on the Audacity forum and the confusion with
(GETENV) has just been discovered.

However the real question here is concerning the (GET-ENV) function, or
whatever it was eventually named, that you committed to the Nyquist source
back in December 2009

I've looked in xlsys.c and the changes that relate to this time period are
in 	revision 1.4 by rbd, Sat Dec 12 03:31:55 2009 UTC
This only mentions "getenv", but it appears to tie in with the code that
edgar-rtf wrote for determining the HOME-PATH.

The practical task in question is how to reliably write a text file to a
location that is accessible to the average Audacity user. This was the same
question back in December last year and I thought it had been resolved, but
we are still unable to do so.

The users "HOME" directory would be an obvious choice of where to output a
text file as the user will have read/write access on all platforms. The
question now, as it was last December, is how to do that.

For some reason (unknown to myself) if I enter (get-env "HOME") or (get-env
'home) at the Nyquist prompt, it returns my Home directory "/home/steve".
This is with Audacity 1.3.13 alpha built from SVN head on Ubuntu 10.10.
However if I enter (get-env "HOME") at the Nyquist prompt in Audacity 1.3.12
I get "error: unbound function - GET-ENV"

Another user has tried (get-env 'home) on Audacity 1.3.12-alpha-Oct 20 2010
(CVS HEAD from yesterday) on Debian_5 (Lenny) and also gets "error: unbound
function - GET-ENV"

Another user has tested with Audacity 1.3.12 (release build) on Windows XP
and also gets "error: unbound function - GET-ENV"

So the question is, is there a way for a Nyquist plug-in to determine the
users "HOME-Path", and if so, how?