Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "bugfix",
"description": "Fix Windows user PATH corruption in install.bat caused by setx silently truncating values over 1024 characters",
"pull_requests": [
"[#3117](https://github.com/smithy-lang/smithy/pull/3117)"
]
}
9 changes: 7 additions & 2 deletions smithy-cli/configuration/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ if exist "%choice_path%" goto upgrade

:: Copy the installation
xcopy /i /h /e /k "%installer_path%*" "%choice_path%\"
setx path "%path%;%choice_path%\;"
call %exe_name% warmup
set "smithy_install_dir=%choice_path%"
powershell -Command "& { $installDir = $env:smithy_install_dir; $userPath = [Environment]::GetEnvironmentVariable('PATH','User'); if ([string]::IsNullOrEmpty($userPath)) { [Environment]::SetEnvironmentVariable('PATH', $installDir, 'User') } elseif (-not $userPath.Contains($installDir)) { [Environment]::SetEnvironmentVariable('PATH', $userPath.TrimEnd(';') + ';' + $installDir, 'User') } }"
Comment thread
kstich marked this conversation as resolved.
if %ERRORLEVEL% neq 0 (
echo Failed to update PATH. You may need to add %choice_path% to your PATH manually.
goto done
)
call "%choice_path%\bin\%exe_name%" warmup
echo You may now run '%exe_name% --version'
goto done

Expand Down
Loading