From 61581f8b17fa2afe5ec03455303a92e59d5e3697 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 1 Oct 2009 11:36:50 +0000 Subject: [PATCH] Issue 0020377: [windows] Problems with OSD_File Remove --- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 8558200..32eb55b 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -47,11 +47,11 @@ #include #include #include -#include #include #include #include #include +#include // 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"); } -- 2.39.2