@@ -5,16 +5,16 @@ function create_startmenu_shortcuts($manifest, $dir, $global, $arch) {
5
5
$target = [System.IO.Path ]::Combine($dir , $_.item (0 ))
6
6
$target = New-Object System.IO.FileInfo($target )
7
7
$name = $_.item (1 )
8
- $arguments = " "
8
+ $arguments = ' '
9
9
$icon = $null
10
- if ($_.length -ge 3 ) {
10
+ if ($_.length -ge 3 ) {
11
11
$arguments = $_.item (2 )
12
12
}
13
- if ($_.length -ge 4 ) {
13
+ if ($_.length -ge 4 ) {
14
14
$icon = [System.IO.Path ]::Combine($dir , $_.item (3 ))
15
15
$icon = New-Object System.IO.FileInfo($icon )
16
16
}
17
- $arguments = (substitute $arguments @ { ' $dir' = $dir ; ' $original_dir' = $original_dir ; ' $persist_dir' = $persist_dir })
17
+ $arguments = (substitute $arguments @ { ' $dir' = $dir ; ' $original_dir' = $original_dir ; ' $persist_dir' = $persist_dir })
18
18
startmenu_shortcut $target $name $arguments $icon $global
19
19
}
20
20
}
@@ -29,11 +29,11 @@ function shortcut_folder($global) {
29
29
}
30
30
31
31
function startmenu_shortcut ([System.IO.FileInfo ] $target , $shortcutName , $arguments , [System.IO.FileInfo ]$icon , $global ) {
32
- if (! $target.Exists ) {
32
+ if (! $target.Exists ) {
33
33
Write-Host -f DarkRed " Creating shortcut for $shortcutName ($ ( fname $target ) ) failed: Couldn't find $target "
34
34
return
35
35
}
36
- if ($icon -and ! $icon.Exists ) {
36
+ if ($icon -and ! $icon.Exists ) {
37
37
Write-Host -f DarkRed " Creating shortcut for $shortcutName ($ ( fname $target ) ) failed: Couldn't find icon $icon "
38
38
return
39
39
}
@@ -51,22 +51,22 @@ function startmenu_shortcut([System.IO.FileInfo] $target, $shortcutName, $argume
51
51
if ($arguments ) {
52
52
$wsShell.Arguments = $arguments
53
53
}
54
- if ($icon -and $icon.Exists ) {
54
+ if ($icon -and $icon.Exists ) {
55
55
$wsShell.IconLocation = $icon.FullName
56
56
}
57
57
$wsShell.Save ()
58
- write-host " Creating shortcut for $shortcutName ($ ( fname $target ) )"
58
+ Write-Host " Creating shortcut for $shortcutName ($ ( fname $target ) )"
59
59
}
60
60
61
61
# Removes the Startmenu shortcut if it exists
62
62
function rm_startmenu_shortcuts ($manifest , $global , $arch ) {
63
63
$shortcuts = @ (arch_specific ' shortcuts' $manifest $arch )
64
64
$shortcuts | Where-Object { $_ -ne $null } | ForEach-Object {
65
65
$name = $_.item (1 )
66
- $shortcut = " $ ( shortcut_folder $global ) \$name .lnk"
67
- write-host " Removing shortcut $ ( friendly_path $shortcut ) "
68
- if (Test-Path - Path $shortcut ) {
69
- Remove-Item $shortcut
66
+ $shortcut = $ExecutionContext .SessionState.Path.GetUnresolvedProviderPathFromPSPath ( " $ ( shortcut_folder $global ) \$name .lnk" )
67
+ Write-Host " Removing shortcut $ ( friendly_path $shortcut ) "
68
+ if (Test-Path - Path $shortcut ) {
69
+ Remove-Item $shortcut
70
70
}
71
71
}
72
72
}
0 commit comments