[Windows] Improve R finding for special installation #1051
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #995
After some tests with R installation with Scoop and rig on Windows, here are some ajustement in what we are doing.
With this change:
R_HOMEis set and takes precedence.For
scoop, as described in #995, the installation will not add aRscript.exefile inR_HOME/bin, they will be inR_HOME/bin/x64only. I kept the adjustment simple for now by adding directly the path tox64folder if none is found in rootbinfolder. This is really scoped to the specific issue. If we want more generic approach, it could be clever to search for theRscript.exewithin theR_HOMEfolder and take the first one found. Could be done by refactoring the search in program filesquarto-cli/src/core/resources.ts
Lines 97 to 106 in abb46a3
If needed, I'll add that.
For
rig, it took me more time to test because I found a few issues that messed up my system; They are reported in https://github.com/r-lib/rig. It helps though identified one thing:which()usesCMD /C WHERE <binary>. This command on windows will return all the files found, and not just the only one likewhichon Linux. I added a handling of this: we are keeping only the first path returned.Regarding search in registry, , I noticed a few things that I was not sure :
Is there a reason to no read the version install path in two steps ?
quarto-cli/src/core/resources.ts
Lines 76 to 93 in abb46a3
Software\\R-core\\Ras aInstallPathvalue directly. So I was wondering by curiosity. I did not change anything as this is working fine currently.Slightly unrelated, we have two sets of registry reading functions: in
registry.tsand inwindows.ts. Should we try refactor into one set for easier upkeep in the future ? Asking because I fixed one issue in the past inwindows.tsfor chrome finding, but not the other that I wasn't aware of.