18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/xcode_trash_remover/core.rb', line 18
def remove_trash
total = total_size
puts "Total #{total}"
puts '-'
if total.zero?
puts 'The directories are empty. No trash files.'
exit(0)
end
dirs = [
Dir.glob("#{File.expand_path('~')}/Library/Developer/Xcode/DerivedData/*"),
Dir.glob("#{File.expand_path('~')}/Library/Developer/Xcode/Archives/*"),
Dir.glob("#{File.expand_path('~')}/Library/Developer/XCPGDevices/*"),
Dir.glob("#{File.expand_path('~')}/Library/Developer/CoreSimulator/Devices/*")
]
dirs.each do |dir|
dir.each do |subdir|
remove_dir(subdir)
end
end
puts "#{total} bytes removed!"
end
|