ENH: #include: allow dictionary variables in include paths

This commit is contained in:
mattijs
2012-10-12 12:23:34 +01:00
parent 23c4157fea
commit dced4a082a
4 changed files with 18 additions and 11 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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)