Fix bug: 2175043. Crash when destination file not writable or path doesn't exists.
authorCarlos Lopez <carlos@pcnuevo.(none)>
Sun, 12 Jul 2009 17:45:10 +0000 (19:45 +0200)
committerCarlos Lopez <carlos@pcnuevo.(none)>
Sun, 12 Jul 2009 17:45:10 +0000 (19:45 +0200)
synfig-studio/trunk/src/gtkmm/render.cpp

index 4696a47..cec4215 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "general.h"
 
+#include <fstream>
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -287,6 +289,14 @@ RenderSettings::on_render_pressed()
                canvas_interface_->get_ui_interface()->error(_("Unable to create target for ")+filename);
                return;
        }
+       // This is the only way I've found to avoid send a non writable
+       // filename path to the renderer.
+       fstream filetest (filename.c_str(), fstream::out);
+       if (filetest.fail())
+       {
+               canvas_interface_->get_ui_interface()->error(_("Unable to create file for ")+filename);
+               return;
+       }
 
        hide();