summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/graphics
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-06 20:34:05 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-06 20:34:05 (GMT)
commit81079295b8be14128b7e532d504b32280360532e (patch)
tree649f93c2059dcc2a7cf5bd4ace17c18c6913ac64 /src/uscxml/plugins/invoker/graphics
parente385ba8adb0c77fea20c58c45b966193c23a4570 (diff)
downloaduscxml-81079295b8be14128b7e532d504b32280360532e.zip
uscxml-81079295b8be14128b7e532d504b32280360532e.tar.gz
uscxml-81079295b8be14128b7e532d504b32280360532e.tar.bz2
Fixed issue with temporary files
Diffstat (limited to 'src/uscxml/plugins/invoker/graphics')
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
index fbc244a..09cf663 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
@@ -503,17 +503,29 @@ 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 + ".tmp");
- if (success) {
- int err = rename(std::string(_filename + ".tmp").c_str(), _filename.c_str());
+// URL fileURL(_filename);
+// fileURL.path()
+
+ std::string tmpName = _filename;
+ size_t pathSep = _filename.find_last_of(PATH_SEPERATOR);
+ if (pathSep != std::string::npos) {
+ tmpName = _filename.substr(0, pathSep) + PATH_SEPERATOR + ".tmp" + _filename.substr(pathSep + 1, _filename.length() - pathSep - 1);
+ }
+
+ bool success = osgDB::writeImageFile(image, tmpName); // <- no plugin to write to .tmp format
+ if (!success) {
+ _converter->reportFailure(_req);
+ return;
+ }
+
+ if (pathSep != std::string::npos) {
+ int err = rename(tmpName.c_str(), _filename.c_str());
if (err) {
_converter->reportFailure(_req);
- } else {
- _converter->reportSuccess(_req);
}
- } else {
- _converter->reportFailure(_req);
}
+
+ _converter->reportSuccess(_req);
}
} \ No newline at end of file