From 1719f4269afdaa09e9d39df1713c3d8cc917e74c Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 22 Mar 2015 12:12:42 +0100 Subject: [PATCH] + check if directory exists when trying to save image --- src/Gui/View3DPy.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index 35c935051..5a06d8203 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -27,6 +27,8 @@ # include "InventorAll.h" # include # include +# include +# include # include # include # include @@ -689,6 +691,10 @@ Py::Object View3DInventorPy::saveImage(const Py::Tuple& args) if (!PyArg_ParseTuple(args.ptr(), "s|iiss",&cFileName,&w,&h,&cColor,&cComment)) throw Py::Exception(); + QFileInfo fi(QString::fromUtf8(cFileName)); + if (!fi.absoluteDir().exists()) + throw Py::RuntimeError("Directory where to save image doesn't exist"); + QColor bg; QString colname = QString::fromLatin1(cColor); if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive) == 0)