From murdoch at stats.uwo.ca  Thu Nov 24 13:11:13 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 24 Nov 2005 07:11:13 -0500
Subject: [Rd] Changes to Windows registry in R-2.2.0
In-Reply-To: <200511241032.jAOAWDv09528@mcs.st-and.ac.uk>
References: <200511241032.jAOAWDv09528@mcs.st-and.ac.uk>
Message-ID: <4385ADE1.9020906@stats.uwo.ca>

On 11/24/2005 5:37 AM, Len Thomas wrote:
> R-Devel,
> 
> I note from the CHANGES log accompanying the Windows version of R-2.2.0 that 
> the behaviour with respect to the Windows registry has changed.  It says:
> 
> "If the user chooses to register R during installation, a registry entry
> HKEY_LOCAL_MACHINE\Software\R-core\R\{version}\InstallPath will be added.
> Users require administrative privileges to create this key.  For others,
> the same key will be put under the HKEY_CURRENT_USER root."
> 
> The old behaviour was to add or modify the registry entry at
> HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath
> (ie the same entry, but without the extra {version} key).   Having installed 
> R-2.2.0, I notice that the entry at this location, which used to say
> C:\Program Files\R\R-2.1.1
> now says
> C:\Program Files\R\R-2.2.0
> I also tried deleting the \R-core\R key, and re-installing R, and it added 
> both the 
> HKEY_LOCAL_MACHINE\Software\R-core\R\R-2.2.0\InstallPath
> and
> HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath
> entries
> 
> In other words, the new behaviour seems to be to *both* modify/add an entry 
> under
> HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath
> *and* 
> HKEY_LOCAL_MACHINE\Software\R-core\R\{version}\InstallPath
> 
> I note also that it adds another entry 
> HKEY_LOCAL_MACHINE\Software\R-core\R\Current Version
> 
> My questions are:
> 
> (1) Am I correct that this is the new behaviour?

Yes.  The value in Current Version can be used to select the subkey from 
\R to find the InstallPath.
> 
> (2) Can the appropriate developer confirm that this behaviour will be 
> continued in future versions (at least for a while)?  I ask, because I 
> distribute software that uses R, and it uses the 
> HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath
> to find R.  (It will also now look under HKEY_CURRENT_USER, as documented in 
> CHANGES.)  If future versions will not update this entry, then I'll switch 
> the behaviour of my software.

The undocumented behaviour (putting InstallPath directly below \R) will 
eventually go away.  It's there for now for backwards compatibility. 
The problem as you've seen is that it gets overwritten every time you 
install a new version.  Some people will have multiple versions 
installed, and there was a request for a mechanism to allow tools to 
find them.

You can probably find that if you look back through the archives in this 
list (check the revision log on developer.r-project.org for the dates of 
the changes if you are having trouble).  The code to do this is in 
src/gnuwin32/installer/JRins.pl, a Perl script that writes out an Inno 
Setup installer script.

> (3) Might it be worth documenting this behaviour somewhere?  I've searched 
> all the files in the R-2.2.0 distribution and didn't find it, as well as 
> looking in the recent r-devel and r-help archives.

The folks who need this are pretty rare, but if you want to work out an 
appropriate place for the documentation (I'd guess the R-Admin or 
R-Extensions manual) and write it up I'll consider it for addition 
there.  The source for those manuals is in Texinfo format (.texi); don't 
edit the HTML versions.

> There is one out-of-date entry: in R-2.2.0\doc\manual\R-exts.html it says:
> [...]
> Find and set the R home directory and the user's home directory.  The
> former may be available from the Windows Registry: it will normally be
> in <code>HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath</code> and can be
> set there by running the program <span class="file">R_HOME\bin\RSetReg.exe
> </span>

Thanks, I'll fix that.

Duncan Murdoch
> 
> Perhaps I missed it elsewhere?
> 
> Thanks for any help,
> 
>  - Len Thomas
> 
> 
> --
> Len Thomas   len at mcs.st-and.ac.uk    http://www.creem.st-and.ac.uk/len/
> Centre for Research into Ecological and Environmental Modelling
> The Observatory, University of St Andrews, Scotland KY16 9LZ
> Tel. (0)1334-461801  Fax. (0)1334-461800  Secretary (0)1334-461842
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Changes to Windows registry in R-2.2.0
Duncan Murdoch