mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
- provided OSD_FileSystem::OpenOStream() for output streams - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <OSD_FileSystem.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_Texture, Standard_Transient)
|
||||
|
||||
@@ -316,25 +315,26 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
|
||||
// ================================================================
|
||||
Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFile)
|
||||
{
|
||||
std::ofstream aFileOut;
|
||||
OSD_OpenStream (aFileOut, theFile.ToCString(), std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
if (!aFileOut)
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
opencascade::std::shared_ptr<std::ostream> aFileOut = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
if (aFileOut.get() == NULL)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("Error: Unable to create file '") + theFile + "'");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!WriteImage (aFileOut, theFile))
|
||||
if (!WriteImage (*aFileOut, theFile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
aFileOut.close();
|
||||
if (!aFileOut.good())
|
||||
aFileOut->flush();
|
||||
if (!aFileOut->good())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("Error: Unable to write file '") + theFile + "'");
|
||||
return false;
|
||||
}
|
||||
aFileOut.reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user