0032455: Data Exchange - replace OSD_OpenStream() usage with OSD_FileSystem::DefaultF...
[occt.git] / src / LDOM / LDOMParser.cxx
index adf8d9b..6ee1ecf 100644 (file)
@@ -24,7 +24,7 @@
 #include <LDOM_BasicText.hxx>
 #include <LDOM_CharReference.hxx>
 #include <TCollection_ExtendedString.hxx>
-#include <OSD_OpenFile.hxx>
+#include <OSD_FileSystem.hxx>
 
 #include <fcntl.h>
 #ifdef _MSC_VER
@@ -147,12 +147,12 @@ Standard_Boolean LDOMParser::parse (std::istream& anInput,
 
 Standard_Boolean LDOMParser::parse (const char * const aFileName)
 {
-  std::ifstream aFileStream;
-  OSD_OpenStream (aFileStream, aFileName, std::ios::in);
+  const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
+  opencascade::std::shared_ptr<std::istream> aFileStream = aFileSystem->OpenIStream (aFileName, std::ios::in);
 
-  if (aFileStream.good())
+  if (aFileStream.get() != NULL && aFileStream->good())
   {
-    return parse (aFileStream);
+    return parse (*aFileStream);
   }
   else
   {