mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 06:59:07 +08:00
$script:MyInvocation.MyCommand.Definition
It works also in cases where scripts/functions are calling each other. Without the $script prefix, it would instead give you the calling function OR the path if there was no parent function. With the prefix, it always yields the directory of the script
This commit is contained in:
parent
62c8626f4d
commit
a5fe308ea3
@ -13,7 +13,7 @@ function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string]
|
||||
return
|
||||
}
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
. "$scriptsDir\VcpkgPowershellUtils.ps1"
|
||||
|
||||
$profileEntry = "Import-Module '$scriptsDir\posh-vcpkg'"
|
||||
|
@ -4,7 +4,7 @@ param(
|
||||
[Parameter(Mandatory=$False)][string]$withVSPath = ""
|
||||
)
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
|
||||
Write-Verbose("vcpkg Path " + $vcpkgRootDir)
|
||||
|
||||
|
@ -3,7 +3,7 @@ param(
|
||||
[Parameter(Mandatory=$true)][string]$Dependency
|
||||
)
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
. "$scriptsDir\VcpkgPowershellUtils.ps1"
|
||||
|
||||
Write-Verbose "Fetching dependency: $Dependency"
|
||||
|
@ -6,7 +6,7 @@ param(
|
||||
|
||||
$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
$VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1
|
||||
if ($VisualStudioInstallationInstances -eq $null)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ param(
|
||||
|
||||
)
|
||||
|
||||
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
|
||||
$vswhereExe = (& $scriptsDir\fetchDependency.ps1 "vswhere") -replace "<sol>::" -replace "::<eol>"
|
||||
|
||||
$output = & $vswhereExe -prerelease -legacy -products * -format xml
|
||||
|
Loading…
Reference in New Issue
Block a user