rig icon indicating copy to clipboard operation
rig copied to clipboard

[Windows] Possibly include (sym)links to current *.exe files in c:\Program Files\R\bin

Open morphatic opened this issue 1 year ago • 5 comments

In addition to the *.bat files in C:\Program Files\R\bin it would be great if there were also copies or symlinks to the current R.exe and RScript.exe.

I use Git Bash running in Windows Terminal (instead of PowerShell or CMD). This allows me to use the *nix style of almost everything without having to install WSL2. I ❤️ that rig adds C:\Program Files\R\bin to the PATH and puts the current version of R in that location. It's very intuitive.

However, Git Bash doesn't recognize *.bat files as being executables (although you can run them if you type out the whole path).

I'm not a Rustacean, but I suspect that somewhere in sc_system_make_links() it would mean creating a symbolic link to the R.exe and Rscript.exe files in, e.g. C:\Program Files\R\R-4.3.1\bin. Is something like this pretty straightforward?

What I currently do now (manually) to achieve this:

  1. Open Windows Terminal as administrator
  2. Navigate to C:\Program Files\R
  3. Create a symbolic link to the current version, e.g. ln -s ../R-4.3.1 current
  4. Make sure that C:\Program Files\R\current\bin is added to my PATH

About My Setup Windows 11 on x64. Installed rig with scoop. Using Git Bash profile inside of Windows Terminal as my default terminal environment.

morphatic avatar Oct 04 '23 19:10 morphatic

I have some vague memories that symlinks didn't work well on Windows, that's why I started creating the .bat files. (On other platforms rig uses symlinks.)

But let me experiment with it, if is works for you, that's a good start. It is possible that they are OK on modern Windows, but not on older Windows, but then we could still use them on newer Windows.

gaborcsardi avatar Oct 04 '23 20:10 gaborcsardi

Just upvoting this one! I'm loving rig as a project, but running into similar friction with just the .bat files specifically in conjunction with the Quarto VS Code extension. (I don't think details are really important, but happy to share if interested.) Right now, I'm solving for it by setting the QUARTO_R environment variable separately and pointing to the bin/ file for the specific version, but it's definitely less elegant than fully embracing rig

emilyriederer avatar Jan 07 '24 00:01 emilyriederer