ENH: add stub function to codedFixedValueFvPatchScalarField for version checking

- eg, fixedValue10_<SHA1>, its existence indicates that the correct
  library has been loaded
This commit is contained in:
Mark Olesen
2011-02-24 08:54:12 +01:00
parent b0e39f71c3
commit 6eb982573c
5 changed files with 81 additions and 28 deletions

View File

@ -49,6 +49,28 @@ const Foam::fileName Foam::codeStreamTools::codeTemplateDirName
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
void Foam::codeStreamTools::checkSecurity
(
const char* title,
const dictionary& context
)
{
if (isAdministrator())
{
FatalIOErrorIn
(
title,
context
) << "This code should not be executed by someone with administrator"
<< " rights due to security reasons." << nl
<< "(it writes a shared library which then gets loaded "
<< "using dlopen)"
<< exit(FatalIOError);
}
}
Foam::fileName Foam::codeStreamTools::codePath(const word& subDirName)
{
return stringOps::expand("$FOAM_CASE/codeStream/" + subDirName);
@ -253,6 +275,13 @@ bool Foam::codeStreamTools::copyFilesContents(const fileName& dir) const
// variables mapping
HashTable<string> mapping(copyFiles_[i]);
mapping.set("typeName", name_);
// provide a zero digest if not otherwise specified
if (!mapping.found("SHA1sum"))
{
mapping.insert("SHA1sum", SHA1Digest().str());
}
copyAndExpand(is, os, mapping);
}