From 8aa58c986c6f2d1a6d8095a4f59987ddef1c1fe1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 31 Aug 2006 13:53:38 +0000 Subject: [PATCH] Changed the external file writing to use the DatabasePathList for its path rather than the original files path. --- src/osgPlugins/ive/ProxyNode.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/ive/ProxyNode.cpp b/src/osgPlugins/ive/ProxyNode.cpp index 088433e63..82b7af889 100644 --- a/src/osgPlugins/ive/ProxyNode.cpp +++ b/src/osgPlugins/ive/ProxyNode.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "Exception.h" #include "ProxyNode.h" @@ -65,6 +66,14 @@ void ProxyNode::write(DataOutputStream* out) out->writeUInt(getNumFileNames()); unsigned int numChildrenToWriteOut = 0; unsigned int i; + + std::string writeDirectory; + if (!(out->getOptions()->getDatabasePathList().empty())) writeDirectory = out->getOptions()->getDatabasePathList().front(); + + if (!writeDirectory.empty()) writeDirectory = writeDirectory + "/"; + + bool writeOutExternalIVEFIles = !out->getIncludeExternalReferences() && out->getWriteExternalReferenceFiles() && !out->getUseOriginalExternalReferences(); + for(i=0; igetUseOriginalExternalReferences()) + if(!writeOutExternalIVEFIles) { out->writeString(getFileName(i)); } else { - std::string ivename = osgDB::getFilePath(getFileName(i)) +"/"+ osgDB::getStrippedName(getFileName(i)) +".ive"; + std::string ivename = writeDirectory + osgDB::getStrippedName(getFileName(i)) +".ive"; out->writeString(ivename); } } @@ -109,13 +118,13 @@ void ProxyNode::write(DataOutputStream* out) } else if(out->getWriteExternalReferenceFiles()) { - if(out->getUseOriginalExternalReferences()) + if(!writeOutExternalIVEFIles) { osgDB::writeNodeFile(*getChild(i), getFileName(i)); } else { - std::string ivename = osgDB::getFilePath(getFileName(i)) +"/"+ osgDB::getStrippedName(getFileName(i)) +".ive"; + std::string ivename = writeDirectory + osgDB::getStrippedName(getFileName(i)) +".ive"; osgDB::writeNodeFile(*getChild(i), ivename); } }