diff --git a/lib/commands/reshim.bash b/lib/commands/reshim.bash index 2317973a..c5f116ad 100644 --- a/lib/commands/reshim.bash +++ b/lib/commands/reshim.bash @@ -78,7 +78,7 @@ write_shim_script() { local version=$2 local executable_path=$3 - if ! is_executable "$executable_path"; then + if ! is_executable "$executable_path" && ! is_executable "$executable_path.exe"; then return 0 fi @@ -107,6 +107,32 @@ $(sort -u <"$temp_versions_path") exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@" # asdf_allow: ' asdf ' EOF + if [ "$OSTYPE" == "msys" ] || [ "$OSTYPE" == "win32" ]; then + cat <"$shim_path.bat" +@ECHO OFF +$(sort -u <"$temp_versions_path" | sed -En "s/# /REM /p") + +IF "%1"=="" ( + GOTO NO_ARGS +) ELSE ( + GOTO ARGS_EXIST +) + +:NO_ARGS +bash "$HOME/.asdf/shims/${executable_name}" +GOTO EXIT + +:ARGS_EXIST +SET ARGUMENTS=%* +SET ARGUMENTS=%ARGUMENTS:\\=\\\\% +bash "$HOME/.asdf/shims/${executable_name}" %ARGUMENTS% +GOTO EXIT + +:EXIT + +EOF + fi + rm "$temp_versions_path" chmod +x "$shim_path" diff --git a/lib/utils.bash b/lib/utils.bash index 21978a92..a36ed1e8 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -618,6 +618,9 @@ plugin_executables() { for bin_path in "${all_bin_paths[@]}"; do for executable_file in "$bin_path"/*; do if is_executable "$executable_file"; then + if [[ "$executable_file" == *".exe" ]]; then + executable_file=${executable_file::-4} + fi printf "%s\n" "$executable_file" fi done