Exporters: raise errors if output files cannot be opened.

This commit is contained in:
Alexander Gessler
2013-06-25 14:09:28 +02:00
parent b5e916a646
commit 34d2bdd178
4 changed files with 17 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ void ExportSceneSTL(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
// we're still here - export successfully completed. Write the file.
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
if(outfile == NULL) {
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
}
outfile->Write( exporter.mOutput.str().c_str(), static_cast<size_t>(exporter.mOutput.tellp()),1);
}