summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
index 2fa2877..fbc244a 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
@@ -502,9 +502,15 @@ void OSGConverter::dumpMatrix(const osg::Matrix& m) {
}
void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image, const unsigned int context_id) {
- bool success = osgDB::writeImageFile(image, _filename);
+
+ bool success = osgDB::writeImageFile(image, _filename + ".tmp");
if (success) {
- _converter->reportSuccess(_req);
+ int err = rename(std::string(_filename + ".tmp").c_str(), _filename.c_str());
+ if (err) {
+ _converter->reportFailure(_req);
+ } else {
+ _converter->reportSuccess(_req);
+ }
} else {
_converter->reportFailure(_req);
}