From: vsr Date: Thu, 1 Oct 2009 11:15:36 +0000 (+0000) Subject: Issue 0020377: [windows] Problems with OSD_File Remove X-Git-Tag: V5_1_3rc1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=417c06b5ac6e2e44fa9d5f6c33396a87015e5b7b;p=plugins%2Fnetgenplugin.git Issue 0020377: [windows] Problems with OSD_File Remove --- diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index da66ea1..819dc12 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -53,6 +53,7 @@ #include #include #include +#include // Netgen include files namespace nglib { @@ -69,6 +70,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"); + } +} + //============================================================================= /*! * @@ -956,14 +967,8 @@ 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"); }