From: gc Date: Sat, 22 Mar 2008 14:51:52 +0000 (+0000) Subject: File.rename does not work between mountpoints X-Git-Tag: 0.9.0~66 X-Git-Url: http://git.zarb.org/?p=booh;a=commitdiff_plain;h=eb7d9c27caffb7ae088061d9b4043f107a7b94e5 File.rename does not work between mountpoints --- diff --git a/bin/booh-classifier b/bin/booh-classifier index 5e21813..cbc18d5 100644 --- a/bin/booh-classifier +++ b/bin/booh-classifier @@ -1339,10 +1339,10 @@ def execute destination = stuff[key][:pathlabel].text label2entries[key].each { |entry| if stuff[key][:combo].active == 0 - File.rename(entry.path, File.join(destination, File.basename(entry.path))) + system("mv '#{entry.path}' '#{destination}'") or raise "failed to move '#{entry.path}'" moved += 1 elsif stuff[key][:combo].active == 1 - system("cp -dp '#{entry.path}' '#{destination}'") + system("cp -dp '#{entry.path}' '#{destination}'") or raise "failed to copy '#{entry.path}'" copied += 1 end } @@ -1359,7 +1359,7 @@ def execute end rescue msg 1, "woops: #{$!}" - show_popup(dialog, utf8(_("Unexpected system call error: '%s'.") % $!)) + show_popup(dialog, utf8(_("Unexpected error: '%s'.") % $!)) end show_popup(dialog, utf8(_("Successfully moved %d files, copied %d file, and removed %d files.") % [ moved, copied, removed ])) dialog.destroy