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
13 changes: 8 additions & 5 deletions eng/common/mcp/azure-sdk-mcp.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/env pwsh
#!/usr/bin/env pwsh

#Requires -Version 7.0
#Requires -PSEdition Core
Expand Down Expand Up @@ -61,11 +61,14 @@ $tempExe = Install-Standalone-Tool `
-Directory $tempInstallDirectory `
-Repository $Repository

Copy-Item -Path $tempExe -Destination $toolInstallDirectory -Force
if (-not (Test-Path $toolInstallDirectory)) {
New-Item -ItemType Directory -Path $toolInstallDirectory -Force | Out-Null
}
$exeName = Split-Path $tempExe -Leaf
$exe = Join-Path $toolInstallDirectory $exeName
$exeDestination = Join-Path $toolInstallDirectory $exeName
Copy-Item -Path $tempExe -Destination $exeDestination -Force

Write-Host "Package $package is installed at $exe"
Write-Host "Package $package is installed at $exeDestination"
if (!$UpdatePathInProfile) {
Write-Warning "To add the tool to PATH for new shell sessions, re-run with -UpdatePathInProfile to modify the shell profile file."
} else {
Expand All @@ -74,5 +77,5 @@ if (!$UpdatePathInProfile) {
}

if ($Run) {
Start-Process -WorkingDirectory $RunDirectory -FilePath $exe -ArgumentList 'start' -NoNewWindow -Wait
Start-Process -WorkingDirectory $RunDirectory -FilePath $exeDestination -ArgumentList 'start' -NoNewWindow -Wait
}
4 changes: 2 additions & 2 deletions eng/common/scripts/Helpers/AzSdkTool-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ function Add-InstallDirectoryToPathInProfile(

if (!$configContent -or !$configContent.Contains($markerComment)) {
Write-Host "Adding installation to PATH in shell profile at '$configFile'"
Add-Content -Path $configFile -Value $pathCommand
Add-Content -Path $configFile -Value ([Environment]::NewLine + $pathCommand)
}
}
}