#include <GEOMImpl_Types.hxx>
#include <GEOM_wrap.hxx>
+#include <boost/filesystem.hpp>
+namespace boofs = boost::filesystem;
+
#define GMFVERSION GmfDouble
#define GMFDIMENSION 3
}
}
+// 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 );
+}
+
//=============================================================================
/*!
*
// Close Files
mgInput->GmfCloseMesh( verticesFileID );
+ chmodUserOnly(myVerticesFile.c_str());
mgInput->GmfCloseMesh( solFileID );
+ chmodUserOnly(mySolFile.c_str());
std::vector<std::string> fileNames(2);
fileNames[0] = myVerticesFile;
if ( aTmpDir.Value(aTmpDir.Length()) != '/' ) aTmpDir += '/';
#endif
TCollection_AsciiString Hexotic_In(""), Hexotic_Out, Hexotic_SizeMap_Prefix;
- TCollection_AsciiString modeFile_In( "chmod 666 " ), modeFile_Out( "chmod 666 " );
TCollection_AsciiString aLogFileName = aTmpDir + "Hexotic"+getSuffix()+".log"; // log
std::map <int,int> aSmdsToHexoticIdMap;
if ( mgHexa.IsExecutable() )
{
-#ifndef WIN32
- modeFile_In += Hexotic_In;
- system( modeFile_In.ToCString() );
-#endif
+ chmodUserOnly(Hexotic_In.ToCString());
}
aSmdsToHexoticIdMap.clear();
aHexoticIdToNodeMap.clear();
std::string errStr;
Ok = mgHexa.Compute( run_Hexotic, errStr ); // run
+ chmodUserOnly(aLogFileName.ToCString());
// --------------
// read a result
// --------------
- if ( mgHexa.IsExecutable() && SMESH_File( Hexotic_Out.ToCString() ).exists() )
+ if ( mgHexa.IsExecutable() )
{
-#ifndef WIN32
- modeFile_Out += Hexotic_Out;
- system( modeFile_Out.ToCString() );
-#endif
+ chmodUserOnly( Hexotic_Out.ToCString() );
}
SMESH_MesherHelper aHelper( aMesh );
TCollection_AsciiString aTmpDir = _hexoticWorkingDirectory.c_str();//getTmpDir();
TCollection_AsciiString Hexotic_In, Hexotic_Out, Hexotic_SizeMap_Prefix;
- TCollection_AsciiString modeFile_In( "chmod 666 " ), modeFile_Out( "chmod 666 " );
TCollection_AsciiString aLogFileName = aTmpDir + "Hexotic"+getSuffix()+".log"; // log
std::map <int,int> aSmdsToHexoticIdMap;
writeInput( &mgHexa, Hexotic_In.ToCString(), aHelper->GetMeshDS() );
if ( mgHexa.IsExecutable() )
{
-#ifndef WIN32
- modeFile_In += Hexotic_In;
- system( modeFile_In.ToCString() );
-#endif
+ chmodUserOnly( Hexotic_In.ToCString() );
}
aSmdsToHexoticIdMap.clear();
aHexoticIdToNodeMap.clear();
std::string errStr;
Ok = mgHexa.Compute( run_Hexotic, errStr ); // run
+ chmodUserOnly(aLogFileName.ToCString());
+
// --------------
// read a result
// --------------
- if ( mgHexa.IsExecutable() && SMESH_File( Hexotic_Out.ToCString() ).exists() )
+ if ( mgHexa.IsExecutable() )
{
- modeFile_Out += Hexotic_Out;
- system( modeFile_Out.ToCString() );
+ chmodUserOnly(Hexotic_Out.ToCString());
}
Ok = Ok && readResult( &mgHexa, Hexotic_Out.ToCString(), this, aHelper );