From: vsr Date: Thu, 1 Oct 2009 11:30:43 +0000 (+0000) Subject: Issue 0020377: [windows] Problems with OSD_File Remove X-Git-Tag: V4_1_0_maintainance_FINAL X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac1fa25299843b05c75bc5418173ea91a55e7e55;p=plugins%2Fghs3dprlplugin.git Issue 0020377: [windows] Problems with OSD_File Remove --- 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 : "<