mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: fileName - added isAbsolute function
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -60,6 +60,20 @@ bool Foam::fileName::isAbsolute() const
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName& Foam::fileName::toAbsolute()
|
||||
{
|
||||
fileName& f = *this;
|
||||
|
||||
if (!f.isAbsolute())
|
||||
{
|
||||
f = cwd()/f;
|
||||
f.clean();
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// * remove repeated slashes
|
||||
// /abc////def --> /abc/def
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -147,6 +147,9 @@ public:
|
||||
//- Return true if file name is absolute
|
||||
bool isAbsolute() const;
|
||||
|
||||
//- Convert from relative to absolute
|
||||
fileName& toAbsolute();
|
||||
|
||||
|
||||
// Decomposition
|
||||
|
||||
|
||||
Reference in New Issue
Block a user