+ check if directory exists when trying to save image
This commit is contained in:
parent
f87fbe7e2a
commit
1719f4269a
|
@ -27,6 +27,8 @@
|
||||||
# include "InventorAll.h"
|
# include "InventorAll.h"
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# include <QColor>
|
# include <QColor>
|
||||||
|
# include <QDir>
|
||||||
|
# include <QFileInfo>
|
||||||
# include <QImage>
|
# include <QImage>
|
||||||
# include <QGLFramebufferObject>
|
# include <QGLFramebufferObject>
|
||||||
# include <QGLPixelBuffer>
|
# include <QGLPixelBuffer>
|
||||||
|
@ -689,6 +691,10 @@ Py::Object View3DInventorPy::saveImage(const Py::Tuple& args)
|
||||||
if (!PyArg_ParseTuple(args.ptr(), "s|iiss",&cFileName,&w,&h,&cColor,&cComment))
|
if (!PyArg_ParseTuple(args.ptr(), "s|iiss",&cFileName,&w,&h,&cColor,&cComment))
|
||||||
throw Py::Exception();
|
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;
|
QColor bg;
|
||||||
QString colname = QString::fromLatin1(cColor);
|
QString colname = QString::fromLatin1(cColor);
|
||||||
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive) == 0)
|
if (colname.compare(QLatin1String("Current"), Qt::CaseInsensitive) == 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user