mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-24 04:15:08 -07:00
fix: Support for Windows with Git-Bash or MSYS Bash
- .exe executables are shims to non-extensions path - .bat files to reshim for cmd or Powershell - .bat execute bash script with bash built Windows
This commit is contained in:
parent
c5116dca60
commit
40ea0e1ce6
@ -78,7 +78,7 @@ write_shim_script() {
|
|||||||
local version=$2
|
local version=$2
|
||||||
local executable_path=$3
|
local executable_path=$3
|
||||||
|
|
||||||
if ! is_executable "$executable_path"; then
|
if ! is_executable "$executable_path" && ! is_executable "$executable_path.exe"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -107,6 +107,32 @@ $(sort -u <"$temp_versions_path")
|
|||||||
exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@" # asdf_allow: ' asdf '
|
exec $(asdf_dir)/bin/asdf exec "${executable_name}" "\$@" # asdf_allow: ' asdf '
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
if [ "$OSTYPE" == "msys" ] || [ "$OSTYPE" == "win32" ]; then
|
||||||
|
cat <<EOF >"$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"
|
rm "$temp_versions_path"
|
||||||
|
|
||||||
chmod +x "$shim_path"
|
chmod +x "$shim_path"
|
||||||
|
@ -618,6 +618,9 @@ plugin_executables() {
|
|||||||
for bin_path in "${all_bin_paths[@]}"; do
|
for bin_path in "${all_bin_paths[@]}"; do
|
||||||
for executable_file in "$bin_path"/*; do
|
for executable_file in "$bin_path"/*; do
|
||||||
if is_executable "$executable_file"; then
|
if is_executable "$executable_file"; then
|
||||||
|
if [[ "$executable_file" == *".exe" ]]; then
|
||||||
|
executable_file=${executable_file::-4}
|
||||||
|
fi
|
||||||
printf "%s\n" "$executable_file"
|
printf "%s\n" "$executable_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user