]> SALOME platform Git repositories - plugins/netgenplugin.git/commitdiff
Salome HOME
Issue 0020377: [windows] Problems with OSD_File Remove
authorvsr <vsr@opencascade.com>
Thu, 1 Oct 2009 11:36:50 +0000 (11:36 +0000)
committervsr <vsr@opencascade.com>
Thu, 1 Oct 2009 11:36:50 +0000 (11:36 +0000)
src/NETGENPlugin/NETGENPlugin_Mesher.cxx

index 8558200f81617176135c52961885a343afb253f5..32eb55bfae64a0c5504b4e209bf5149d9c888d66 100644 (file)
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <NCollection_Map.hxx>
-#include <OSD_Path.hxx>
 #include <OSD_File.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <Standard_ErrorHandler.hxx>
+#include <Standard_ProgramError.hxx>
 
 // Netgen include files
 namespace nglib {
@@ -68,6 +68,16 @@ namespace netgen {
 
 using namespace std;
 
+static void removeFile( const TCollection_AsciiString& fileName )
+{
+  try {
+    OSD_File( fileName ).Remove();
+  }
+  catch ( Standard_ProgramError ) {
+    MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied");
+  }
+}
+
 //=============================================================================
 /*!
  *
@@ -945,12 +955,6 @@ bool NETGENPlugin_Mesher::Compute()
 
 void NETGENPlugin_Mesher::RemoveTmpFiles()
 {
-  TCollection_AsciiString str("test.out");
-  OSD_Path path1( str );
-  OSD_File file1( path1 );
-  file1.Remove();
-  str = "problemfaces";
-  OSD_Path path2( str );
-  OSD_File file2( path2 );
-  file2.Remove();
+  removeFile("test.out");
+  removeFile("problemfaces");
 }