dynamicCode.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "dynamicCode.H"
30 #include "dynamicCodeContext.H"
31 #include "argList.H"
32 #include "stringOps.H"
33 #include "Fstream.H"
34 #include "IOstreams.H"
35 #include "OSspecific.H"
36 #include "etcFiles.H"
37 #include "dictionary.H"
38 #include "foamVersion.H"
39 
40 #ifdef __APPLE__
41  #define EXT_SO ".dylib"
42 #elif defined _WIN32
43  #define EXT_SO ".dll"
44 #else
45  #define EXT_SO ".so"
46 #endif
47 
48 
49 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
50 
52 (
53  Foam::debug::infoSwitch("allowSystemOperations", 0)
54 );
55 
56 
58  = "FOAM_CODE_TEMPLATES";
59 
61  = "codeTemplates/dynamicCode";
62 
63 const char* const Foam::dynamicCode::libTargetRoot =
64  "LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib";
65 
66 const char* const Foam::dynamicCode::topDirName = "dynamicCode";
67 
68 
69 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
70 
72 (
73  const char* title,
74  const dictionary& dict
75 )
76 {
77  if (isAdministrator())
78  {
80  << "This code should not be executed by someone"
81  << " with administrator rights for security reasons." << nl
82  << "It generates a shared library which is loaded using dlopen"
83  << nl << endl
84  << exit(FatalIOError);
85  }
86 
87  if (!allowSystemOperations)
88  {
90  << "Loading shared libraries using case-supplied code may have"
91  << " been disabled" << nl
92  << "by default for security reasons." << nl
93  << "If you trust the code, you may enable this by adding"
94  << nl << nl
95  << " allowSystemOperations 1" << nl << nl
96  << "to the InfoSwitches setting in the system controlDict." << nl
97  << "The system controlDict is any of" << nl << nl
98  << " ~/.OpenFOAM/" << foamVersion::api << "/controlDict" << nl
99  << " ~/.OpenFOAM/controlDict" << nl
100  << " $WM_PROJECT_DIR/etc/controlDict" << nl << endl
101  << exit(FatalIOError);
102  }
103 }
104 
105 
107 {
108  word libName(libPath.nameLessExt());
109  libName.removeStart("lib"); // Remove leading 'lib' from name
110  return libName;
111 }
112 
113 
114 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
115 
117 (
118  ISstream& is,
119  OSstream& os,
120  const HashTable<string>& mapping
121 )
122 {
123  if (!is.good())
124  {
126  << "Failed opening for reading " << is.name()
127  << exit(FatalError);
128  }
129 
130  if (!os.good())
131  {
133  << "Failed writing " << os.name()
134  << exit(FatalError);
135  }
136 
137  // Copy file while rewriting $VARS and ${VARS}
138  string line;
139  do
140  {
141  is.getLine(line);
142 
143  // Expand according to HashTable mapping, not the environment.
144  // Expanding according to env variables might cause too many
145  // surprises
146  stringOps::inplaceExpand(line, mapping);
147  os.writeQuoted(line, false) << nl;
148  }
149  while (is.good());
150 }
151 
152 
154 (
155  const UList<fileName>& templateNames,
156  DynamicList<fileName>& resolvedFiles,
157  DynamicList<fileName>& badFiles
158 )
159 {
160  // Try to get template from FOAM_CODESTREAM_TEMPLATES
161  const fileName templateDir(Foam::getEnv(codeTemplateEnvName));
162 
163  bool allOkay = true;
164  for (const fileName& templateName : templateNames)
165  {
166  fileName file;
167  if (!templateDir.empty() && isDir(templateDir))
168  {
169  file = templateDir/templateName;
170  if (!isFile(file, false))
171  {
172  file.clear();
173  }
174  }
175 
176  // Not found - fallback to <etc> expansion
177  if (file.empty())
178  {
179  file = findEtcFile(codeTemplateDirName/templateName);
180  }
181 
182  if (file.empty())
183  {
184  badFiles.append(templateName);
185  allOkay = false;
186  }
187  else
188  {
189  resolvedFiles.append(file);
190  }
191  }
192 
193  return allOkay;
194 }
195 
196 
198 {
199  const auto fnd = filterVars_.cfind("SHA1sum");
200 
201  if (!fnd.found())
202  {
203  return false;
204  }
205 
206  os << "/* dynamicCode:\n * SHA1 = ";
207  os.writeQuoted(*fnd, false) << "\n */\n";
208  return true;
209 }
210 
211 
213 {
214  // Create Make/files
215  if (compileFiles_.empty())
216  {
217  return false;
218  }
219 
220  const fileName dstFile(this->codePath()/"Make/files");
221 
222  // Create dir
223  mkDir(dstFile.path());
224 
225  OFstream os(dstFile);
226  //Debug: Info<< "Writing to " << dstFile << endl;
227  if (!os.good())
228  {
230  << "Failed writing " << dstFile
231  << exit(FatalError);
232  }
233 
234  writeCommentSHA1(os);
235 
236  // Write compile files
237  for (const fileName& file : compileFiles_)
238  {
239  os.writeQuoted(file, false) << nl;
240  }
241 
242  os << nl
243  << libTargetRoot << codeName_.c_str() << nl;
244 
245  return true;
246 }
247 
248 
250 {
251  // Create Make/options
252  if (compileFiles_.empty() || makeOptions_.empty())
253  {
254  return false;
255  }
256 
257  const fileName dstFile(this->codePath()/"Make/options");
258 
259  // Create dir
260  mkDir(dstFile.path());
261 
262  OFstream os(dstFile);
263  //Debug: Info<< "Writing to " << dstFile << endl;
264  if (!os.good())
265  {
267  << "Failed writing " << dstFile
268  << exit(FatalError);
269  }
270 
271  writeCommentSHA1(os);
272  os.writeQuoted(makeOptions_, false) << nl;
273 
274  return true;
275 }
276 
277 
279 {
280  const fileName file = digestFile();
281  mkDir(file.path());
282 
283  OFstream os(file);
284  sha1.write(os, true) << nl;
285 
286  return os.good();
287 }
288 
289 
290 bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
291 {
292  const fileName file = digestFile();
293  mkDir(file.path());
294 
295  OFstream os(file);
296  os << '_';
297  os.writeQuoted(sha1, false) << nl;
298 
299  return os.good();
300 }
301 
302 
303 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
304 
305 Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
306 :
307  codeRoot_(argList::envGlobalPath()/topDirName),
308  libSubDir_(stringOps::expand("platforms/${WM_OPTIONS}/lib")),
309  codeName_(codeName),
310  codeDirName_(codeDirName)
311 {
312  if (codeDirName_.empty())
313  {
314  codeDirName_ = codeName_;
315  }
316 
317  clear();
318 }
319 
320 
321 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
322 
324 {
325  return topDirName/codeDirName_;
326 }
327 
328 
330 {
331  return codeRoot_/libSubDir_/"lib" + codeName_ + EXT_SO;
332 }
333 
334 
336 {
337  return codeRelPath()/libSubDir_/"lib" + codeName_ + EXT_SO;
338 }
339 
340 
342 {
343  compileFiles_.clear();
344  copyFiles_.clear();
345  createFiles_.clear();
346  filterVars_.clear();
347  filterVars_.set("typeName", codeName_);
348  filterVars_.set("SHA1sum", SHA1Digest().str());
349 
350  // Default Make/options
351  makeOptions_ =
352  "EXE_INC = -g\n"
353  "\n\nLIB_LIBS = ";
354 }
355 
356 
358 (
359  const dynamicCodeContext& context
360 )
361 {
362  clear();
363  setFilterContext(context);
364 }
365 
366 
368 {
369  compileFiles_.append(name);
370 }
371 
372 
374 {
375  copyFiles_.append(name);
376 }
377 
378 
380 (
381  const fileName& name,
382  const string& contents
383 )
384 {
385  createFiles_.append(fileAndContent(name, contents));
386 }
387 
388 
390 (
391  const dynamicCodeContext& context
392 )
393 {
394  filterVars_.set("localCode", context.localCode());
395  filterVars_.set("code", context.code());
396  filterVars_.set("codeInclude", context.include());
397  filterVars_.set("SHA1sum", context.sha1().str());
398 }
399 
400 
402 (
403  const word& key,
404  const std::string& value
405 )
406 {
407  filterVars_.set(key, value);
408 }
409 
410 
411 void Foam::dynamicCode::setMakeOptions(const std::string& content)
412 {
413  makeOptions_ = content;
414 }
415 
416 
417 bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
418 {
419  if (verbose)
420  {
421  DetailInfo
422  << "Creating new library in " << this->libRelPath() << endl;
423  }
424 
425  const label nFiles = compileFiles_.size() + copyFiles_.size();
426 
427  DynamicList<fileName> resolvedFiles(nFiles);
428  DynamicList<fileName> badFiles(nFiles);
429 
430  // Resolve template, or add to bad-files
431  resolveTemplates(compileFiles_, resolvedFiles, badFiles);
432  resolveTemplates(copyFiles_, resolvedFiles, badFiles);
433 
434  if (!badFiles.empty())
435  {
437  << "Could not find code template(s): "
438  << badFiles << nl
439  << "Under the $" << codeTemplateEnvName
440  << " directory or via the <etc>/"
441  << codeTemplateDirName << " expansion"
442  << exit(FatalError);
443  }
444 
445 
446 
447  // Create dir
448  const fileName outputDir = this->codePath();
449 
450  // Create dir
451  mkDir(outputDir);
452 
453  // Copy/filter files
454  for (const fileName& srcFile : resolvedFiles)
455  {
456  const fileName dstFile(outputDir/srcFile.name());
457 
458  IFstream is(srcFile);
459  //Debug: Info<< "Reading from " << is.name() << endl;
460  if (!is.good())
461  {
463  << "Failed opening " << srcFile
464  << exit(FatalError);
465  }
466 
467  OFstream os(dstFile);
468  //Debug: Info<< "Writing to " << dstFile.name() << endl;
469  if (!os.good())
470  {
472  << "Failed writing " << dstFile
473  << exit(FatalError);
474  }
475 
476  // Copy lines while expanding variables
477  copyAndFilter(is, os, filterVars_);
478  }
479 
480 
481  // Create files:
482  for (const fileAndContent& content : createFiles_)
483  {
484  const fileName dstFile(outputDir/stringOps::expand(content.first()));
485 
486  mkDir(dstFile.path());
487  OFstream os(dstFile);
488  //Debug: Info<< "Writing to " << content.first() << endl;
489  if (!os.good())
490  {
492  << "Failed writing " << dstFile
493  << exit(FatalError);
494  }
495  os.writeQuoted(content.second(), false) << nl;
496  }
497 
498 
499  // Create Make/files + Make/options
500  createMakeFiles();
501  createMakeOptions();
502 
503  writeDigest(filterVars_["SHA1sum"]);
504 
505  return true;
506 }
507 
508 
510 {
511  stringList cmd({"wmake", "-s", "libso", this->codePath()});
512 
513  // NOTE: could also resolve wmake command explicitly
514  // cmd[0] = stringOps::expand("$WM_PROJECT_DIR/wmake/wmake");
515 
516  // This can take a bit longer, so report that we are starting wmake
517 
518  if (Foam::infoDetailLevel > 0)
519  {
520  Info<< "Invoking wmake libso " << this->codePath().c_str() << endl;
521  }
522  else
523  {
524  // Even with details turned off, we want some feedback
525  Serr<< "Invoking wmake libso " << this->codePath().c_str() << endl;
526  }
527 
528  if (Foam::system(cmd) == 0)
529  {
530  return true;
531  }
532 
533  return false;
534 }
535 
536 
538 {
539  const fileName file = digestFile();
540 
541  if (!exists(file, false) || SHA1Digest(IFstream(file)()) != sha1)
542  {
543  return false;
544  }
545 
546  return true;
547 }
548 
549 
551 {
552  return upToDate(context.sha1());
553 }
554 
555 
556 // ************************************************************************* //
OSspecific.H
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::dynamicCode::createMakeFiles
bool createMakeFiles() const
Copy/create Make/files prior to compilation.
Definition: dynamicCode.C:212
Foam::exists
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:625
Foam::dynamicCode::topDirName
static const char *const topDirName
Top-level directory name for copy/compiling.
Definition: dynamicCode.H:112
Foam::dynamicCode::writeCommentSHA1
bool writeCommentSHA1(Ostream &) const
Write SHA1 value as C-comment.
Definition: dynamicCode.C:197
Foam::fileName::nameLessExt
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
Definition: fileName.C:402
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ISstream::getLine
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline into a string function.
Definition: ISstreamI.H:78
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::dynamicCode::copyAndFilter
static void copyAndFilter(ISstream &, OSstream &, const HashTable< string > &mapping)
Copy lines while expanding variables.
Definition: dynamicCode.C:117
Foam::SHA1::str
std::string str(const bool prefixed=false) const
The digest (40-byte) text representation, optionally with '_' prefix.
Definition: SHA1I.H:123
Foam::dynamicCode::copyOrCreateFiles
bool copyOrCreateFiles(const bool verbose=false) const
Copy/create files prior to compilation.
Definition: dynamicCode.C:417
Foam::fileName::path
static std::string path(const std::string &str)
Return directory path name (part before last /)
Definition: fileNameI.H:186
Foam::dynamicCode::wmakeLibso
bool wmakeLibso() const
Compile a libso.
Definition: dynamicCode.C:509
Foam::IFstream
Input from file stream, using an ISstream.
Definition: IFstream.H:97
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:57
Foam::dynamicCodeContext
Encapsulation of dynamic code dictionaries.
Definition: dynamicCodeContext.H:53
Foam::fileName::name
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:209
Foam::system
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
Definition: MSwindows.C:1140
Foam::Ostream::writeQuoted
virtual Ostream & writeQuoted(const std::string &str, const bool quoted=true)=0
Write std::string surrounded by quotes.
Foam::dynamicCode::createMakeOptions
bool createMakeOptions() const
Copy/create Make/options prior to compilation.
Definition: dynamicCode.C:249
Foam::OSstream::writeQuoted
virtual Ostream & writeQuoted(const std::string &str, const bool quoted=true)
Write std::string surrounded by quotes.
Definition: OSstream.C:104
Foam::dynamicCode::writeDigest
bool writeDigest(const SHA1Digest &) const
Write digest to Make/SHA1Digest.
Definition: dynamicCode.C:278
Foam::ISstream
Generic input stream using standard (STL) streams.
Definition: ISstream.H:54
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:123
Foam::isFile
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: MSwindows.C:658
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::dynamicCodeContext::include
const string & include() const
Return the code-includes.
Definition: dynamicCodeContext.H:134
Foam::Serr
OSstream Serr
An Ostream wrapper for std::cerr.
dynamicCodeContext.H
Foam::dynamicCode::setFilterContext
void setFilterContext(const dynamicCodeContext &)
Define filter variables for code, codeInclude, SHA1sum.
Definition: dynamicCode.C:390
Foam::dynamicCode::resolveTemplates
static bool resolveTemplates(const UList< fileName > &templateNames, DynamicList< fileName > &resolvedFiles, DynamicList< fileName > &badFiles)
Resolve code-templates via the codeTemplateEnvName.
Definition: dynamicCode.C:154
Foam::dynamicCode::addCopyFile
void addCopyFile(const fileName &name)
Add a file template name, which will be found and filtered.
Definition: dynamicCode.C:373
Foam::getEnv
string getEnv(const std::string &envName)
Get environment value for given envName.
Definition: MSwindows.C:371
EXT_SO
#define EXT_SO
Definition: dynamicCode.C:45
Foam::dynamicCode::allowSystemOperations
static int allowSystemOperations
Flag if system operations are allowed.
Definition: dynamicCode.H:164
Foam::isAdministrator
bool isAdministrator()
Is the current user the administrator (root)
Definition: MSwindows.C:442
Foam::debug::infoSwitch
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
Definition: debug.C:231
Foam::dynamicCode::libPath
fileName libPath() const
Library path for specified code name.
Definition: dynamicCode.C:329
Foam::dynamicCode::codeTemplateEnvName
static const word codeTemplateEnvName
Name of the code template environment variable.
Definition: dynamicCode.H:157
Foam::dynamicCode::addCompileFile
void addCompileFile(const fileName &name)
Add a file template name, which will be found and filtered.
Definition: dynamicCode.C:367
Foam::foamVersion::api
const int api
Foam::SHA1Digest::write
Ostream & write(Ostream &os, const bool prefixed=false) const
Write (40-byte) text representation, optionally with '_' prefix.
Definition: SHA1Digest.C:156
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::findEtcFile
fileName findEtcFile(const fileName &name, const bool mandatory=false, unsigned short location=0777)
Search for a single FILE within the etc directories.
Definition: etcFiles.C:446
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::OSstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: OSstream.H:91
Foam::DynamicList::append
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Definition: DynamicListI.H:472
argList.H
Foam::dynamicCodeContext::code
const string & code() const
Return the code.
Definition: dynamicCodeContext.H:152
Foam::dynamicCode::checkSecurity
static void checkSecurity(const char *title, const dictionary &)
Check security for creating dynamic code.
Definition: dynamicCode.C:72
Foam::dynamicCode::codeRelPath
fileName codeRelPath() const
Path for specified code name relative to <case>
Definition: dynamicCode.C:323
Foam::stringOps::inplaceExpand
void inplaceExpand(std::string &s, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Definition: stringOps.C:752
dynamicCode.H
Foam::OSstream
Generic output stream.
Definition: OSstream.H:54
Foam::dynamicCode::libRelPath
fileName libRelPath() const
Library path for specified code name relative to <case>
Definition: dynamicCode.C:335
DetailInfo
#define DetailInfo
Definition: evalEntry.C:36
Foam::ISstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: ISstream.H:111
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::SHA1Digest
The SHA1 message digest.
Definition: SHA1Digest.H:60
Foam::dynamicCode::setFilterVariable
void setFilterVariable(const word &key, const std::string &value)
Define a filter variable.
Definition: dynamicCode.C:402
Foam::infoDetailLevel
int infoDetailLevel
Global for selective suppression of Info output.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:99
Foam::dynamicCode::reset
void reset(const dynamicCodeContext &)
Clear files and reset variables to specified context.
Definition: dynamicCode.C:358
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::dynamicCode::libraryBaseName
static word libraryBaseName(const fileName &libPath)
Return the library basename without leading 'lib' or trailing '.so'.
Definition: dynamicCode.C:106
etcFiles.H
Functions to search 'etc' directories for configuration files etc.
Foam::dynamicCodeContext::localCode
const string & localCode() const
Return the local (file-scope) code.
Definition: dynamicCodeContext.H:158
Foam::dynamicCode::upToDate
bool upToDate(const dynamicCodeContext &context) const
Verify if the copied code is up-to-date, based on Make/SHA1Digest.
Definition: dynamicCode.C:550
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::dynamicCode::setMakeOptions
void setMakeOptions(const std::string &content)
Define contents for Make/options.
Definition: dynamicCode.C:411
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Fstream.H
Input/output from file streams.
Foam::dynamicCode::clear
void clear()
Clear files and variables.
Definition: dynamicCode.C:341
Foam::List< string >
Foam::stringOps::expand
string expand(const std::string &str, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Definition: stringOps.C:739
Foam::dynamicCode::codeTemplateDirName
static const fileName codeTemplateDirName
Name of the code template sub-directory.
Definition: dynamicCode.H:161
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
dictionary.H
Foam::line
A line primitive.
Definition: line.H:59
Foam::string::removeStart
bool removeStart(const std::string &text)
Remove the given text from the start of the string.
Definition: string.C:200
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:375
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Tuple2
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:57
Foam::IOstream::good
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:216
Foam::dynamicCodeContext::sha1
const SHA1 & sha1() const
Return SHA1 calculated from options, libs, include, code.
Definition: dynamicCodeContext.H:164
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:507
stringOps.H
Foam::dynamicCode::addCreateFile
void addCreateFile(const fileName &name, const string &contents)
Add a file to create with its contents. Will not be filtered.
Definition: dynamicCode.C:380
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643
Foam::dynamicCode::libTargetRoot
static const char *const libTargetRoot
Root of the LIB target for Make/files.
Definition: dynamicCode.H:109
foamVersion.H