+ 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 <sstream>
|
||||
# include <QColor>
|
||||
# include <QDir>
|
||||
# include <QFileInfo>
|
||||
# include <QImage>
|
||||
# include <QGLFramebufferObject>
|
||||
# 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))
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user