mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide argList::envGlobalPath() static method
- this is identical to either of these solutions:
* getEnv("FOAM_CASE")
* stringOps::expand("<case>")
but with a closer resemblance to argList or Time globalPath(),
which makes the intent clearer.
Avoids using raw strings in the caller, which improves compile-time checks.
Used in situations where a class has no derivation path or other
access to a time registry or command args.
This commit is contained in:
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "noiseModel.H"
|
||||
#include "functionObject.H"
|
||||
#include "stringOps.H"
|
||||
#include "argList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -143,7 +143,7 @@ Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
|
||||
{
|
||||
return
|
||||
(
|
||||
stringOps::expand("<case>") // ie, globalPath()
|
||||
argList::envGlobalPath()
|
||||
/ functionObject::outputPrefix
|
||||
/ "noise"
|
||||
/ outputPrefix_
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "pointNoise.H"
|
||||
#include "noiseFFT.H"
|
||||
#include "stringOps.H"
|
||||
#include "argList.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -244,8 +244,7 @@ void pointNoise::calculate()
|
||||
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
// ie, globalPath() / name
|
||||
fName = stringOps::expand("<case>")/fName;
|
||||
fName = argList::envGlobalPath()/fName;
|
||||
}
|
||||
|
||||
Function1Types::CSV<scalar> data("pressure", dict_, fName);
|
||||
|
||||
@ -27,8 +27,8 @@ License
|
||||
#include "surfaceReader.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "noiseFFT.H"
|
||||
#include "argList.H"
|
||||
#include "graph.H"
|
||||
#include "stringOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -465,8 +465,7 @@ void surfaceNoise::calculate()
|
||||
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
// ie, globalPath() / name
|
||||
fName = stringOps::expand("<case>")/fName;
|
||||
fName = argList::envGlobalPath()/fName;
|
||||
}
|
||||
|
||||
initialise(fName);
|
||||
|
||||
Reference in New Issue
Block a user