Переглянути джерело

Taml Write Creates Path

This change causes Taml::WriteFile to create the path before attempting
to write the file.
Peter Robinson 7 роки тому
батько
коміт
a1e111d891
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      engine/source/persistence/taml/taml.cc

+ 6 - 0
engine/source/persistence/taml/taml.cc

@@ -226,6 +226,12 @@ bool Taml::write( SimObject* pSimObject, const char* pFilename )
     AssertFatal( pSimObject != NULL, "Cannot write a NULL object." );
     AssertFatal( pFilename != NULL, "Cannot write to a NULL filename." );
 
+    if (!Platform::createPath(pFilename))
+    {
+       Con::warnf("Taml::writeFile() - Unable to create path for file '%s'", pFilename);
+       return false;
+    }
+
     // Expand the file-name into the file-path buffer.
     Con::expandPath( mFilePathBuffer, sizeof(mFilePathBuffer), pFilename );