Open morphatic opened 1 year ago
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.
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
@gaborcsardi I know that in uv they use junction points on Windows rather than symlinks and that seems to work for them. Not sure if that could work here, but its possible https://github.com/astral-sh/uv/blob/bd3c4626744aeb5cd1e813b45dbde21f2cdc6335/crates/uv-fs/src/lib.rs#L45-L50
Looks like junctions can't point at individual files, only at directories but maybe we can still make that work https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#junctions
Its possible this is the symlink issue on Windows:
As opposed to symlinks, junction does not require administrator privileges during creation. (However starting with Windows 10 Insiders build 14972, symlinks can be created without needing to elevate the console as administrator)^1.
Mentioned here in the readme of junction https://crates.io/crates/junction
I think it was simply that older windows did not have symlinks at all, at least not on all types of file systems. (rig initially supported Windows 7!) I think admins rights are ok, rig already needs to run as admin to change these links.
In addition to the
*.bat
files inC:\Program Files\R\bin
it would be great if there were also copies or symlinks to the currentR.exe
andRScript.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 thePATH
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 theR.exe
andRscript.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:
C:\Program Files\R
ln -s ../R-4.3.1 current
C:\Program Files\R\current\bin
is added to myPATH
About My Setup Windows 11 on x64. Installed
rig
withscoop
. Using Git Bash profile inside of Windows Terminal as my default terminal environment.