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 20
20
$result.Scope = $Data.scope
21
21
$result.Alias = $Data.alias
22
22
$result.Targets = $Data.targets
23
+ $result.Current = ' '
24
+ if ($Data.ContainsKey (' current' ) -and ($null -ne $Data.current )) {
25
+ $result.Current = $Data.current
26
+ }
23
27
}
24
28
end {
25
29
$result
Original file line number Diff line number Diff line change 21
21
[hashtable ]
22
22
[ValidateNotNull ()]
23
23
$Targets
24
+ <#
25
+ The name of the currently activated version (empty string if none)
26
+ #>
27
+ [string ]
28
+ [ValidateNotNull ()]
29
+ $Current
24
30
}
Original file line number Diff line number Diff line change 29
29
}
30
30
}
31
31
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
+ }
32
39
$data.targets = @ {}
33
40
if ($definition | Get-Member - Name ' Targets' ) {
34
41
try {
35
42
$definition.Targets.PSObject.Properties | ForEach-Object {
36
43
$data.targets [$_.Name ] = [string ] $_.Value
44
+ if ($null -ne $currentTarget ) {
45
+ if ($_.Value -eq $currentTarget ) {
46
+ $data.current = $_.Name
47
+ }
48
+ }
37
49
}
38
50
} catch {
39
51
Write-Debug $_.Exception.Message
You can’t perform that action at this time.
0 commit comments