X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYBRIDPlugin%2FHYBRIDPlugin_HYBRID.cxx;h=f9362f059c87232d2edcc8ae04909f29cfe1799f;hb=7972d6e3ce34777547876d3f4d52fc7c09d39334;hp=26f186de2786238529efdaa02b08d67ddb8e63fd;hpb=bc08bef2116ed9ba6e4adb767a31650d20292cb5;p=plugins%2Fhybridplugin.git diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index 26f186d..f9362f0 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2022 CEA/DEN, EDF R&D +// Copyright (C) 2007-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -70,6 +70,9 @@ #include #include +#include +namespace boofs = boost::filesystem; + #include #include @@ -96,6 +99,13 @@ static void removeFile( const std::string& fileName ) } } +// change results files permissions to user only (using boost to be used without C++17) +static void chmodUserOnly(const char* filename) +{ + if (boofs::exists(filename)) + boofs::permissions(filename, boofs::remove_perms | boofs::group_all | boofs::others_all ); +} + //============================================================================= /*! * @@ -1383,11 +1393,17 @@ static bool writeGMFFile(MG_HYBRID_API* MGInput } MGInput->GmfCloseMesh(idx); + chmodUserOnly(theMeshFileName); if (idxRequired) - MGInput->GmfCloseMesh(idxRequired); + { + MGInput->GmfCloseMesh(idxRequired); + chmodUserOnly(theRequiredFileName); + } if (idxSol) - MGInput->GmfCloseMesh(idxSol); - + { + MGInput->GmfCloseMesh(idxSol); + chmodUserOnly(theSolFileName); + } return true; } @@ -1504,6 +1520,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, } aIdsFile.close(); + chmodUserOnly(aSmdsToHybridIdMapFileName.c_str()); if ( ! Ok ) { if ( !_keepFiles ) { @@ -1546,9 +1563,17 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, if ( _logInStandardOutput && mgHybrid.IsLibrary() ) std::cout << std::endl << mgHybrid.GetLog() << std::endl; + else + chmodUserOnly(aLogFileName.c_str()); if ( Ok ) std::cout << "End of Hybrid execution !" << std::endl; + if ( mgHybrid.IsExecutable() ) + { + chmodUserOnly(aResultFileName.c_str()); + chmodUserOnly(aResSolFileName.c_str()); + } + // -------------- // read a result // -------------- @@ -1745,9 +1770,17 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, if ( _logInStandardOutput && mgHybrid.IsLibrary() ) std::cout << std::endl << mgHybrid.GetLog() << std::endl; + else + chmodUserOnly(aLogFileName.c_str()); if ( Ok ) std::cout << "End of Hybrid execution !" << std::endl; + if (mgHybrid.IsExecutable()) + { + chmodUserOnly(aResultFileName.c_str()); + chmodUserOnly(aResSolFileName.c_str()); + } + // -------------- // read a result // --------------