Module: Cask::Utils::Trash Private

Extended by:
SystemCommand::Mixin
Defined in:
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.

Class Method Summary collapse

Methods included from SystemCommand::Mixin

system_command, system_command!

Class Method Details

.freedesktop_trash(*paths) ⇒ 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.

Parameters:

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'cask/utils/trash.rb', line 23

def self.freedesktop_trash(*paths)
  return [[], []] if paths.empty?

  files_path = home_trash_path/"files"
  info_path = home_trash_path/"info"

  files_path.mkpath
  info_path.mkpath

  trashed, untrashable = paths.partition do |path|
    trash_path(path, files_path:, info_path:)
    true
  rescue
    false
  end

  [trashed.map(&:to_s), untrashable.map(&:to_s)]
end

.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.

Parameters:

Returns:



18
19
20
# File 'cask/utils/trash.rb', line 18

def self.trash(*paths, command: nil)
  freedesktop_trash(*paths)
end