From f9bc0454f87b4e16a0f4e59a643a40e8bc209d5d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 17 May 2005 13:47:13 +0000 Subject: [PATCH] Improved the handling of writing out of proxy node files. --- src/osgPlugins/osg/ProxyNode.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/osg/ProxyNode.cpp b/src/osgPlugins/osg/ProxyNode.cpp index 436328ae0..cd49dc1f2 100644 --- a/src/osgPlugins/osg/ProxyNode.cpp +++ b/src/osgPlugins/osg/ProxyNode.cpp @@ -175,7 +175,9 @@ bool ProxyNode_writeLocalData(const Object& obj, Output& fw) } else { - std::string osgname = osgDB::getFilePath(proxyNode.getFileName(i)) +"/"+ osgDB::getStrippedName(proxyNode.getFileName(i)) +".osg"; + std::string path = osgDB::getFilePath(fw.getFileName()); + std::string new_filename = osgDB::getStrippedName(proxyNode.getFileName(i)) +".osg"; + std::string osgname = path.empty() ? new_filename : (path +"/"+ new_filename) ; fw.indent() << osgname << std::endl; } } @@ -209,7 +211,9 @@ bool ProxyNode_writeLocalData(const Object& obj, Output& fw) } else { - std::string osgname = osgDB::getFilePath(proxyNode.getFileName(i)) +"/"+ osgDB::getStrippedName(proxyNode.getFileName(i)) +".osg"; + std::string path = osgDB::getFilePath(fw.getFileName()); + std::string new_filename = osgDB::getStrippedName(proxyNode.getFileName(i)) +".osg"; + std::string osgname = path.empty() ? new_filename : (path +"/"+ new_filename) ; osgDB::writeNodeFile(*proxyNode.getChild(i), osgname); } }