Sha256: 5de2c1d1f699c30284908a4c1608df7199cec61c93de5c2ca466ec9380db0f90
Contents?: true
Size: 1.11 KB
Versions: 43
Compression:
Stored size: 1.11 KB
Contents
# Migrate trash to correct directory on Linux due to a configuration bug in previous releases. # # It used to be that the default trash path was the same on every platform, so everything used to go to `~/.Trash` # regardless of OS. (For what it's worth, that used to be the correct trash path on older releases of Ubuntu.) module Maid module TrashMigration class << self def incorrect_trash File.expand_path('~/.Trash') + '/' end def correct_trash Maid.new.trash_path end def needed? Platform.linux? && File.directory?(incorrect_trash) && !ENV['MAID_NO_MIGRATE_TRASH'] end def perform maid = ::Maid::Maid.new(:trash_path => correct_trash) # Use local variable so it's available in the closure used by `instance_eval` path = incorrect_trash # Might as well use Maid itself for this :) maid.instance_eval do rule 'Migrate Linux trash to correct path' do trash(dir("#{ path }/*")) trash(path) end end maid.clean end end end end
Version data entries
43 entries across 43 versions & 1 rubygems