Commit 33c1b274 authored by andy's avatar andy
Browse files

ENH: Added caseName option to fileName

parent ce7b8dc2
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -204,6 +204,25 @@ Foam::word Foam::fileName::name() const
}
Foam::string Foam::fileName::caseName() const
{
string cName = *this;
const string caseStr(getEnv("FOAM_CASE"));
const size_type i = find(caseStr);
if (i == npos)
{
return cName;
}
else
{
return cName.replace(i, caseStr.size(), string("$FOAM_CASE"));
}
}
Foam::word Foam::fileName::name(const bool noExt) const
{
if (noExt)
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -153,6 +153,9 @@ public:
//- Return file name (part beyond last /)
word name() const;
//- Return file name (part beyond last /), subsitute for FOAM_CASE
string caseName() const;
//- Return file name, optionally without extension
word name(const bool noExt) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment