-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chocolatey-visualstudio.extension: read manifests from layout, if pre…
- Loading branch information
1 parent
ede5e01
commit c84ad06
Showing
3 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
chocolatey-visualstudio.extension/extensions/Resolve-VSLayoutPath.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function Resolve-VSLayoutPath | ||
{ | ||
[CmdletBinding()] | ||
Param | ||
( | ||
[Parameter(Mandatory = $true)] [hashtable] $PackageParameters | ||
) | ||
|
||
Write-Debug 'Detecting if a layout path was provided via package parameters' | ||
|
||
if ($PackageParameters.ContainsKey('installLayoutPath')) | ||
{ | ||
$installLayoutPath = $PackageParameters['installLayoutPath'] | ||
if (-not [string]::IsNullOrEmpty($installLayoutPath)) | ||
{ | ||
Write-Debug "Using installLayoutPath provided via package parameters: $installLayoutPath" | ||
return $installLayoutPath | ||
} | ||
else | ||
{ | ||
Write-Debug 'Package parameters contain installLayoutPath, but it is empty - ignoring' | ||
} | ||
} | ||
|
||
if ($PackageParameters.ContainsKey('bootstrapperPath')) | ||
{ | ||
$bootstrapperPath = $PackageParameters['bootstrapperPath'] | ||
if (-not [string]::IsNullOrEmpty($bootstrapperPath)) | ||
{ | ||
$installLayoutPath = Split-Path -Path $bootstrapperPath | ||
Write-Debug "Using installLayoutPath computed from bootstrapperPath provided via package parameters: $installLayoutPath" | ||
return $installLayoutPath | ||
} | ||
else | ||
{ | ||
Write-Debug 'Package parameters contain $bootstrapperPath, but it is empty - ignoring' | ||
} | ||
} | ||
|
||
Write-Debug 'A layout path was not provided via package parameters' | ||
return $null | ||
} |