Permalink
Browse files

Added exception handler for duplicate files

  • Loading branch information...
1 parent 2ce4249 commit e350357ea978c72ccfc32f384956be6033107a6b Paul Betts committed Dec 4, 2007
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/library.rb
View
@@ -74,9 +74,9 @@ def load(files, progress_rate = 0.05)
#log DEBUG, 'Reading %s..' % current
# First, see if we've already scanned this file before (save some time
- # and only read the first 256K)
+ # and only read the first 4K)
begin
- md5sum = Digest::MD5.hexdigest(File.open(current, 'r') {|x| x.read(0x40000)})
+ md5sum = Digest::MD5.hexdigest(File.open(current, 'r') {|x| x.read(0x1000)})
if (@tag_info[current] = @md5_index[md5sum])
#log DEBUG, "Cache hit!"
next
@@ -206,8 +206,11 @@ def execute_action_list(list, action, execute_class = DebugList, output_file = n
when :symlink
do_it.link x[0], x[1], x[2]
end
- rescue
- log ERROR, _("Failure processing %s") % x[0]
+ rescue Errno::EEXIST
+ log WARN, _("Duplicate file: %s") % x[0]
+ next
+ rescue
+ log ERROR, _("Failure processing %s: %s") % [x[0], $!]
next
end

0 comments on commit e350357

Please sign in to comment.