mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: #include: allow dictionary variables in include paths
This commit is contained in:
@ -27,6 +27,7 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -68,11 +69,12 @@ namespace functionEntries
|
||||
|
||||
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
|
||||
(
|
||||
Istream& is
|
||||
Istream& is,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fileName fName(is);
|
||||
fName.expand();
|
||||
stringOps::inplaceExpand(fName, dict);
|
||||
|
||||
if (fName.empty() || fName.isAbsolute())
|
||||
{
|
||||
@ -94,7 +96,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -129,7 +131,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -77,7 +77,7 @@ protected:
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read the include fileName from Istream, expand and return
|
||||
static fileName includeFileName(Istream&);
|
||||
static fileName includeFileName(Istream&, const dictionary&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,7 +69,7 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -92,7 +92,7 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -322,7 +322,12 @@ Foam::string& Foam::stringOps::inplaceExpand
|
||||
|
||||
|
||||
// lookup in the dictionary
|
||||
const entry* ePtr = dict.lookupEntryPtr(varName, true, true);
|
||||
const entry* ePtr = dict.lookupScopedEntryPtr
|
||||
(
|
||||
varName,
|
||||
true,
|
||||
false // wildcards disabled. See primitiveEntry
|
||||
);
|
||||
|
||||
// if defined - copy its entries
|
||||
if (ePtr)
|
||||
|
||||
Reference in New Issue
Block a user