[GRASS-dev] Re: [GRASS GIS] #1149: WinGrass - load R-installation-path dynamically into PATH

GRASS GIS trac at osgeo.org
Sun Nov 7 11:07:25 EST 2010


#1149: WinGrass - load R-installation-path dynamically into PATH
-------------------------------+--------------------------------------------
 Reporter:  hellik             |       Owner:  grass-dev@…              
     Type:  enhancement        |      Status:  new                      
 Priority:  normal             |   Milestone:  7.0.0                    
Component:  Startup            |     Version:  svn-trunk                
 Keywords:  wingrass, path, R  |    Platform:  MSWindows Vista          
      Cpu:  x86-32             |  
-------------------------------+--------------------------------------------

Comment(by hellik):

 Replying to [comment:1 glynn]:
 > Replying to [ticket:1149 hellik]:
 >
 > > - which of in the R-Windows-FAQ mentioned registry entries should be
 tested?
 >
 > HKCU first, then HKLM if nothing found under HKCU.

 I have R 2.12.0 installed in C:\Program Files\R\R-2.12.0.

 according to the R-Windows-FAQ, the R-binaries are installed

 {{{
 in a Win32-installation: C:\Program Files\R\R-2.12.0\bin\i386\
 }}}

 {{{
 in a Win64-installation: C:\Program Files\R\R-2.12.0\bin\x64\
 }}}

 If I write following search-routine in a bat-file (for example
 c:\temp\addrtopath.bat) for all possible cases

 {{{
 set RegCommandHKCU32=reg query "HKCU\Software\R-core\R32" /v "InstallPath"
 >nul 2>&1
 FOR /f "tokens=1-2* delims= " %%a IN ('%RegCommandHKCU32% ^| find
 "InstallPath"') do set R_HKCU32_INSTALL_PATH=%%c >nul 2>&1
 IF "%R_HKCU32_INSTALL_PATH%" NEQ ""
 (PATH=%PATH%;%R_HKCU32_INSTALL_PATH%\bin\i386) >nul 2>&1
 set RegCommandHKCU64=reg query "HKCU\Software\R-core\R64" /v "InstallPath"
 >nul 2>&1
 FOR /f "tokens=1-2* delims= " %%a IN ('%RegCommandHKCU64% ^| find
 "InstallPath"') do set R_HKCU64_INSTALL_PATH=%%c >nul 2>&1
 IF "%R_HKCU64_INSTALL_PATH%" NEQ ""
 (PATH=%PATH%;%R_HKCU64_INSTALL_PATH%\bin\x64) >nul 2>&1
 rem Test if R is registered in HKLM
 set RegCommandHKLM32=reg query "HKLM\Software\R-core\R32" /v "InstallPath"
 >nul 2>&1
 FOR /f "tokens=1-2* delims= " %%a IN ('%RegCommandHKLM32% ^| find
 "InstallPath"') do set R_HKLM32_INSTALL_PATH=%%c >nul 2>&1
 IF "%R_HKLM32_INSTALL_PATH%" NEQ ""
 (PATH=%PATH%;%R_HKLM32_INSTALL_PATH%\bin\i386) >nul 2>&1
 set RegCommandHKLM64=reg query "HKLM\Software\R-core\R64" /v "InstallPath"
 >nul 2>&1
 FOR /f "tokens=1-2* delims= " %%a IN ('%RegCommandHKLM64% ^| find
 "InstallPath"') do set R_HKLM64_INSTALL_PATH=%%c >nul 2>&1
 IF "%R_HKLM64_INSTALL_PATH%" NEQ ""
 (PATH=%PATH%;%R_HKLM64_INSTALL_PATH%\bin\x64) >nul 2>&1
 }}}

 and start that bat-file on my winvista32-box in a normal windows-cmd, the
 R-installation is found correctly and in my case C:\Program
 Files\R\R-2.12.0\bin\i386\ is added to path and I can start R by typing R
 in the windows-cmd where I have run the bat-file.

 If I add these line of code above into C:\Program
 Files\GRASS-70-SVN\grass70svn.bat (Wingrass70-starting script), R isn't
 added to the path.

 any hints?

 best regards
 Helmut

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1149#comment:2>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list