stupid gtk sometimes creates folder, sometimes not
authorgc <gc>
Tue, 7 Aug 2007 21:44:16 +0000 (21:44 +0000)
committergc <gc>
Tue, 7 Aug 2007 21:44:16 +0000 (21:44 +0000)
bin/booh-classifier

index 733b255dada92ee5bb564733a37006025b418170..5258c1905bddfb78a33feaacab8c8aad3d6f39b6 100644 (file)
@@ -1153,16 +1153,26 @@ def execute
                             problem = true
                             break
                         end
-                        st = File.stat(destination)
+                        begin
+                            Dir.mkdir(destination)
+                        rescue Errno::EEXIST
+                        end
+                        begin
+                            st = File.stat(destination)
+                        rescue
+                            show_popup(dialog, utf8(_("Directory %s, where to move %s, is not valid or not createable.") % [destination, key.name]))
+                            problem = true
+                            break
+                        end
                         if ! st.directory? || ! st.writable?
-                            show_popup(dialog, utf8(_("Directory where to move %s is not valid or not writable.") % key.name))
+                            show_popup(dialog, utf8(_("Directory %s, where to move %s, is not valid or not writable.") % [destination, key.name]))
                             problem = true
                             break
                         end
                         label2entries[key].each { |entry|
                             begin
                                 File.stat(File.join(destination, File.basename(entry.path)))
-                                show_popup(dialog, utf8(_("Sorry, a file '%s' already exists in '%s'.") % [ File.basename(entry.path), destination ]))
+                                show_popup(dialog, utf8(_("Sorry, a file '%s' already exists in directory '%s'.") % [ File.basename(entry.path), destination ]))
                                 problem = true
                                 break
                             rescue