File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 2020 $result.Scope = $Data.scope
2121 $result.Alias = $Data.alias
2222 $result.Targets = $Data.targets
23+ $result.Current = ' '
24+ if ($Data.ContainsKey (' current' ) -and ($null -ne $Data.current )) {
25+ $result.Current = $Data.current
26+ }
2327 }
2428 end {
2529 $result
Original file line number Diff line number Diff line change 2121 [hashtable ]
2222 [ValidateNotNull ()]
2323 $Targets
24+ <#
25+ The name of the currently activated version (empty string if none)
26+ #>
27+ [string ]
28+ [ValidateNotNull ()]
29+ $Current
2430}
Original file line number Diff line number Diff line change 2929 }
3030 }
3131 if ($data.alias -ne ' ' ) {
32+ $currentTarget = $null
33+ if (Test-Path - LiteralPath $data.alias - PathType Container) {
34+ $aliasItem = Get-Item - LiteralPath $data.alias
35+ if ($aliasItem.LinkType -eq ' Junction' ) {
36+ $currentTarget = $aliasItem.Target
37+ }
38+ }
3239 $data.targets = @ {}
3340 if ($definition | Get-Member - Name ' Targets' ) {
3441 try {
3542 $definition.Targets.PSObject.Properties | ForEach-Object {
3643 $data.targets [$_.Name ] = [string ] $_.Value
44+ if ($null -ne $currentTarget ) {
45+ if ($_.Value -eq $currentTarget ) {
46+ $data.current = $_.Name
47+ }
48+ }
3749 }
3850 } catch {
3951 Write-Debug $_.Exception.Message
You can’t perform that action at this time.
0 commit comments