-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#undef SMESH_CAUGHT
#define SMESH_CAUGHT error =
+constexpr char MESHGEMS_OLD_STYLE[] = "MESHGEMS_OLD_STYLE";
+
namespace
{
std::string outFile = tmpDir + "libMeshGemsKeyGenerator.so";
- std::string cmd = "wget " + url + " -O " + outFile;
+ std::string cmd = "smesh_wget.py " + url + " -O " + outFile;
#endif
}
}
+#ifndef WIN32
+ //[EDF25906]
+ std::string redirect = tmpDir + "redirect.out";
+ std::ostringstream oss;
+ oss << cmd << " " << redirect;
+ cmd = oss.str();
+#endif
+
system( cmd.c_str() ); // download
+#ifndef WIN32
+ {//[EDF25906]
+ std::ifstream infile(redirect);
+ infile.seekg(0, std::ios::end);
+ size_t length = infile.tellg();
+ infile.seekg(0, std::ios::beg);
+ std::unique_ptr<char []> buffer(new char[length+1]);
+ buffer[length] = '\0';
+ infile.read(const_cast<char *>( buffer.get() ),length);
+
+ MESSAGE( buffer.get() )
+ }
+ {
+ SMESH_File redirectFile( redirect, /*open=*/false );
+ redirectFile.remove();
+ }
+#endif
+
SMESH_File resultFile( outFile, /*open=*/false );
bool ok = ( resultFile.exists() && resultFile.size() > 0 );
*/
//================================================================================
- bool SignCAD( void* meshgems_cad, std::string& error )
+ bool SignCAD_After( void* meshgems_cad, std::string& error )
{
LibraryFile libraryFile;
if ( !loadLibrary( error, libraryFile ))
}
return ok;
}
+
+ bool SignCAD( void* meshgems_cad, std::string& error )
+ {
+ const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
+ if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
+ return SignCAD_After(meshgems_cad, error);
+ else
+ return true;
+ }
//================================================================================
/*!
*/
//================================================================================
- bool SignMesh( void* meshgems_mesh, std::string& error )
+ bool SignMesh_After( void* meshgems_mesh, std::string& error )
{
LibraryFile libraryFile;
if ( !loadLibrary( error, libraryFile ))
}
return ok;
}
+
+ bool SignMesh( void* meshgems_mesh, std::string& error )
+ {
+ const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
+ if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
+ return SignMesh_After(meshgems_mesh, error);
+ else
+ return true;
+ }
//================================================================================
/*!
*/
//================================================================================
- std::string GetKey(const std::string& gmfFile,
- int nbVertex,
- int nbEdge,
- int nbFace,
- int nbVol,
- std::string& error)
+ std::string GetKey_After(const std::string& gmfFile,
+ int nbVertex,
+ int nbEdge,
+ int nbFace,
+ int nbVol,
+ std::string& error)
{
std::string key;
LibraryFile libraryFile;
return key;
}
+ std::string GetKey(const std::string& gmfFile,
+ int nbVertex,
+ int nbEdge,
+ int nbFace,
+ int nbVol,
+ std::string& error)
+ {
+ const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
+ if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
+ return GetKey_After(gmfFile,nbVertex,nbEdge,nbFace,nbVol,error);
+ else
+ return std::string("0");
+ }
+
//================================================================================
/*!
* \brief Return false if libMeshGemsKeyGenerator.so is not functional