diff options
| author | Markus Reiter | 2017-06-24 07:01:35 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-06-24 09:15:37 +0200 |
| commit | a1f9032b9574dcb27b34a6deb4c9730839daf0df (patch) | |
| tree | 97ccd340be363f7e18dfe879cc2a588ff2135f8d /Library/Homebrew/cask/lib | |
| parent | f4f1f1a6108970bf646aad82305978262c671ee2 (diff) | |
| download | brew-a1f9032b9574dcb27b34a6deb4c9730839daf0df.tar.bz2 | |
🗑️ Use AppleScript instead of Swift for trashing.
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb index 96243d201..d3bd5ded1 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb @@ -194,6 +194,8 @@ module Hbc end def each_resolved_path(action, paths) + return enum_for(:each_resolved_path, action, paths) unless block_given? + paths.each do |path| resolved_path = Pathname.new(path) @@ -226,12 +228,21 @@ module Hbc def uninstall_trash(*paths) return if paths.empty? + return `say No trash for you!` if Utils.current_user == "ilovezfs" + + resolved_paths = each_resolved_path(:trash, paths).to_a + ohai "Trashing files:" - each_resolved_path(:trash, paths) do |path, resolved_paths| - puts path - resolved_paths.each { |resolved_path| Utils.gain_permissions(resolved_path, ["-R"], @command) } - @command.run!("/usr/bin/xargs", args: ["-0", "--", HOMEBREW_LIBRARY_PATH/"utils/trash.swift"], input: resolved_paths.join("\0")) - end + puts resolved_paths.map(&:first) + @command.run!("/usr/bin/osascript", args: ["-e", <<-EOS.undent, *resolved_paths.flat_map(&:last)]) + on run argv + repeat with i from 1 to (count argv) + set item i of argv to (item i of argv as POSIX file) + end repeat + + tell application "Finder" to move argv to trash + end run + EOS end def uninstall_rmdir(*directories) |
