File.rename does not work between mountpoints
authorgc <gc>
Sat, 22 Mar 2008 14:51:52 +0000 (14:51 +0000)
committergc <gc>
Sat, 22 Mar 2008 14:51:52 +0000 (14:51 +0000)
bin/booh-classifier

index 5e21813..cbc18d5 100644 (file)
@@ -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