From ac5a0717ee55b984a1a9eaa737783ee7afa70061 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 1 Oct 2009 11:30:43 +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 89c2f30..0f9c442 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -53,8 +53,19 @@ using namespace std; #include #include +#include #include +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) @@ -122,7 +133,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString & GHS3DPRL_In, bool Ok; TCollection_AsciiString namefile(GHS3DPRL_In); namefile+=".points"; - OSD_File(namefile).Remove(); + removeFile(namefile); ofstream theFile; theFile.open(namefile.ToCString(),ios::out); #ifdef WIN32 @@ -160,7 +171,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(); @@ -490,7 +501,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, system( run_nokeep_files.ToCString() ); //clean files cout<<"GHS3DPRL command : "<