aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-01-22 18:18:53 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2018-01-23 14:16:06 -0800
commita5fe308ea3c29c5f8715b8f0c78571759541c9b5 (patch)
tree8427a2ccc17ddd61220fb426c55817243e1ae80d /scripts
parent62c8626f4d28344c3cc4b488ffeac51bddb8bbcd (diff)
downloadvcpkg-a5fe308ea3c29c5f8715b8f0c78571759541c9b5.tar.gz
vcpkg-a5fe308ea3c29c5f8715b8f0c78571759541c9b5.zip
$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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/addPoshVcpkgToPowershellProfile.ps12
-rw-r--r--scripts/bootstrap.ps12
-rw-r--r--scripts/fetchDependency.ps12
-rw-r--r--scripts/findAnyMSBuildWithCppPlatformToolset.ps12
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps12
5 files changed, 5 insertions, 5 deletions
diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1
index 7a12e7d34..dcbd2e0be 100644
--- a/scripts/addPoshVcpkgToPowershellProfile.ps1
+++ b/scripts/addPoshVcpkgToPowershellProfile.ps1
@@ -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'"
diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1
index b4749bdd6..2c05f1adb 100644
--- a/scripts/bootstrap.ps1
+++ b/scripts/bootstrap.ps1
@@ -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)
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index 7629a0c2c..6bb87fec4 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -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"
diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
index 46ba767b9..570ebdf44 100644
--- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
+++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
@@ -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)
{
diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1
index e3bc67ff6..359da9caa 100644
--- a/scripts/findVisualStudioInstallationInstances.ps1
+++ b/scripts/findVisualStudioInstallationInstances.ps1
@@ -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