简体   繁体   English

对于什么是R for Windows'“当前版本”和“安装路径”注册表项使用?

[英]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从命令行启动时(或者从emacsstatconnDCOM启动 ),它使用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. 这就是我认为的原因。

  1. 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/或它的子目录。

  2. 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环境空间”中找到它。

  3. 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链接到其他应用程序”。)

  4. 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM