Update check_shim_reachable
to correctly handle Windows
#1846
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.
Closes #1845
Info
We have a helper utility
check_shim_reachable
that notifies the user if the shim for a tool they just installed is on their PATH and whether it's shadowed. However, that check currently assumes that all shims are inVoltaHome::shim_dir
. Unfortunately, on Windows that isn't the case—we install the default shims alongside Volta itself inside ofProgram Files
.To prevent showing an unnecessary message to Windows users, we should properly check both Volta directories on Windows when validating whether a shim is properly available on the Path.
Changes
check_shim_reachable
to call a new functionfind_expected_shim_dir
to determine which directory should be used as the base when checking for the shim.find_expected_shim_dir
for both Unix and Windows;VOLTA_HOME
, because all of the shims are installed there, even the default ones.VOLTA_HOME
shim directory, and if the shim isn't found there, it defaults to theVoltaInstall
root directory, which should be where Volta itself is installed.starts_with
rather than a pure equality to determine if the resolved binary matches the expectation or not.Tested