From e1a526904bb6cb97e33c22ff59647366d04c710e Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 1 Oct 2009 11:13:51 +0000 Subject: [PATCH] Issue 0020377: [windows] Problems with OSD_File Remove --- src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index bae42d6..fefff87 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -66,6 +67,16 @@ extern "C" { } using namespace med_2_2;*/ +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"); + } +} + //============================================================================= GHS3DPRLPlugin_GHS3DPRL::GHS3DPRLPlugin_GHS3DPRL(int hypId, int studyId, SMESH_Gen* gen) : SMESH_3D_Algo(hypId, studyId, gen) @@ -130,7 +141,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString & GHS3DPRL_In, int ifam=0; TCollection_AsciiString namefile(GHS3DPRL_In); namefile+=".points"; - OSD_File(namefile).Remove(); + removeFile(namefile); ofstream theFile; theFile.open(namefile.ToCString(),ios::out); #ifdef WIN32 @@ -173,7 +184,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString & GHS3DPRL_In, theFile.close(); namefile=GHS3DPRL_In+".faces"; - OSD_File(namefile).Remove(); + removeFile(namefile); theFile.open(namefile.ToCString(),ios::out); #ifdef WIN32 Ok=theFile->is_open(); @@ -510,7 +521,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, cout<<"GHS3DPRL command : "<