Module: OS::Mac::Cask::Utils::Trash::ClassMethods Private
- Includes:
- SystemCommand::Mixin
- Defined in:
- extend/os/mac/cask/utils/trash.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Instance Method Summary collapse
Methods included from SystemCommand::Mixin
#system_command, #system_command!
Instance Method Details
#trash(*paths, command: nil) ⇒ Array<(Array<String>, Array<String>)>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'extend/os/mac/cask/utils/trash.rb', line 20 def trash(*paths, command: nil) return swift_trash(*paths, command:) unless ffi_trash? trashed, untrashable = MacOS::FFI::Foundation.trash_paths(paths.map(&:to_s)) = T.let([], T::Array[String]) still_untrashable = T.let([], T::Array[String]) untrashable.each do |path| destination = T.let(nil, T.nilable(String)) ::Cask::Utils.(::Pathname.new(path), ["-R"], ::SystemCommand) do destination = MacOS::FFI::Foundation.trash_item(path) Kernel.raise if destination.nil? end if destination.nil? still_untrashable << path else << destination end rescue still_untrashable << path end [trashed + , still_untrashable] end |