Skip to content

Commit

Permalink
Allow architecture specific shortcuts for special cases like dont-sle…
Browse files Browse the repository at this point in the history
…ep or mpc-hc
  • Loading branch information
Richard Kuhnt committed May 23, 2017
1 parent a4d44ac commit 884a7a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function install_app($app, $architecture, $global, $suggested) {
ensure_install_dir_not_in_path $dir $global
$dir = link_current $dir
create_shims $manifest $dir $global $architecture
create_startmenu_shortcuts $manifest $dir $global
create_startmenu_shortcuts $manifest $dir $global $architecture
install_psmodule $manifest $dir $global
if($global) { ensure_scoop_in_path $global } # can assume local scoop is in path
env_add_path $manifest $dir $global
Expand Down
10 changes: 6 additions & 4 deletions lib/shortcuts.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Creates shortcut for the app in the start menu
function create_startmenu_shortcuts($manifest, $dir, $global) {
$manifest.shortcuts | ?{ $_ -ne $null } | % {
function create_startmenu_shortcuts($manifest, $dir, $global, $arch) {
$shortcuts = @(arch_specific 'shortcuts' $manifest $arch)
$shortcuts | ?{ $_ -ne $null } | % {
$target = $_.item(0)
$name = $_.item(1)
startmenu_shortcut "$dir\$target" $name
Expand Down Expand Up @@ -28,8 +29,9 @@ function startmenu_shortcut($target, $shortcutName) {
}

# Removes the Startmenu shortcut if it exists
function rm_startmenu_shortcuts($manifest, $global) {
$manifest.shortcuts | ?{ $_ -ne $null } | % {
function rm_startmenu_shortcuts($manifest, $global, $arch) {
$shortcuts = @(arch_specific 'shortcuts' $manifest $arch)
$shortcuts | ?{ $_ -ne $null } | % {
$name = $_.item(1)
$shortcut = "$(shortcut_folder)\$name.lnk"
write-host "Removing shortcut $(friendly_path $shortcut)"
Expand Down
2 changes: 1 addition & 1 deletion libexec/scoop-uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ foreach($app in $apps) {

run_uninstaller $manifest $architecture $dir
rm_shims $manifest $global $architecture
rm_startmenu_shortcuts $manifest $global
rm_startmenu_shortcuts $manifest $global $architecture

# If a junction was used during install, that will have been used
# as the reference directory. Otherwise it will just be the version
Expand Down
3 changes: 3 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
"pre_install": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"shortcuts": {
"$ref": "#/definitions/arrayOfArrayOfStrings"
},
"uninstaller": {
"$ref": "#/definitions/uninstaller"
},
Expand Down

0 comments on commit 884a7a3

Please sign in to comment.