[英]For what are R for Windows' “Current Version” and “Install Path” registry entries used?
Here are the two registry entries I'm asking about.** 这是我要问的两个注册表项。**
HKEY_LOCAL_MACHINE\Software\R-core\R\Current Version
HKEY_LOCAL_MACHINE\Software\R-core\R\version\InstallPath
When R is launched from the command line (or from emacs , or statconnDCOM for that matter) it uses whatever version appears first in Windows' Path
environment variable. 当R从命令行启动时(或者从emacs或statconnDCOM启动 ),它使用Windows的
Path
环境变量中首先出现的任何版本。 By contrast, double clicking on a *.Rdata
file uses the version pointed to by the relevant file association entry in HKEY_CLASSES_ROOT
. 相反,双击
*.Rdata
文件将使用HKEY_CLASSES_ROOT
相关文件关联条目指向的版本。
But when or by what are the two HKEY_LOCAL_MACHINE
entries used? 但是什么时候使用两个
HKEY_LOCAL_MACHINE
条目?
EDIT: Brian Diggs points to a bundle of Windows *.bat
files that do use (and modify) these registry entries, but I'm still interested in whether anything closer to 'core' R uses these. 编辑: Brian Diggs指向一组Windows
*.bat
文件,它们使用(并修改)这些注册表项,但我仍然对是否有更接近'core'R的东西感兴趣。 (I'm hoping the answer is 'no'.) (我希望答案是'不'。)
** As described in the R for Windows FAQ , these entries may be set either during installation (by clicking 'Save version number in registry') or later from the command line (by typing RSetReg.exe
from within $RHOME\\bin
). **正如描述的Windows FAQ研发 ,这些项目可能会在安装过程中(点击“注册表中保存版本号”)或更高版本的命令行(键入以设置
RSetReg.exe
从内部$RHOME\\bin
)。
One set of programs which use these are the R batchfiles which states 使用这些程序的一组程序是R批处理文件
These programs set the version of R (and version of R Tools and miktex) by (1) examining environment variables (R_HOME, R_MIKTEX, R_TOOLS) or (2) if not set they look in the registry.
这些程序通过(1)检查环境变量(R_HOME,R_MIKTEX,R_TOOLS)或(2)(如果未设置它们在注册表中查找)来设置R(以及R Tools和miktex的版本)的版本。
Major edit: 主要编辑:
It looks like those registry entries are primarily there for use by external applications. 看起来这些注册表项主要供外部应用程序使用。
Here's why I think that. 这就是我认为的原因。
grep'ing HKEY_LOCAL_MACHINE
in the R sources turns up four hits in just three files. R源中的grep'ing
HKEY_LOCAL_MACHINE
仅在三个文件中出现四次点击。 The files -- "extra.c"
, "RSetReg.c"
, and "rhome.c"
-- are all located in R-2.15.0/src/gnuwin/
or its subdirectories. 该文件-
"extra.c"
"RSetReg.c"
和"rhome.c"
-均位于R-2.15.0/src/gnuwin/
或它的子目录。
The relevant occurrence appears to be that in R-2.15.0/src/gnuwin/rhome.c
, where it is used by the C function get_R_HOME
. 相关的出现似乎是在
R-2.15.0/src/gnuwin/rhome.c
,它由C函数get_R_HOME
。 That function is designed to 该功能旨在
/* get R_HOME from environment or registry: used in embedded apps */
/ *从环境或注册表获取R_HOME:在嵌入式应用程序中使用* /
and it searches in the registry only if R_HOME
if it has not yet been found in the "C environment space" or the "Windows API environment space". 并且它仅在
R_HOME
搜索,如果尚未在“C环境空间”或“Windows API环境空间”中找到它。
get_R_HOME
, in turn, only appears in two other files, "R-2.15.0/src/gnuwin/embeddedR.c"
, and "R-2.15.0/src/gnuwin/front-ends/rtest.c"
. 反过来,
get_R_HOME
只出现在另外两个文件"R-2.15.0/src/gnuwin/embeddedR.c"
和"R-2.15.0/src/gnuwin/front-ends/rtest.c"
。 (According to its resident readme
file, the role of "R-2.15.0/src/gnuwin/front-ends/"
is to make it possible to "Link[...] the R DLL into other applications".) (根据其常驻
readme
文件, "R-2.15.0/src/gnuwin/front-ends/"
是使“将[...] R DLL链接到其他应用程序”。)
R's *NIX origins and emphasis on portability make it seem unlikely that anything close to R's core functionality would depend on registry entries. R的* NIX起源和对可移植性的强调使得R的核心功能似乎不太可能依赖于注册表项。 (This item's obviously way more speculative.)
(这个项目显然更具投机性。)
Unless I hear otherwise, that's enough to convince me that the registry entries' only purpose is to provide pointers for external applications, particularly those that use an embedded instance of R. 除非我另有说明,否则这足以让我相信注册表项的唯一目的是为外部应用程序提供指针,特别是那些使用R的嵌入式实例的应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.