Skip to content
Snippets Groups Projects
Commit 5d24a33c authored by andy's avatar andy Committed by Andrew Heather
Browse files

ENH: fileName - added isAbsolute function

parent 468da226
Branches
Tags
No related merge requests found
......@@ -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
......@@ -141,11 +141,14 @@ public:
// Interrogation
//- Return the file type: FILE, DIRECTORY or UNDEFINED
Type type() const;
//- Return the file type: FILE, DIRECTORY or UNDEFINED
Type type() const;
//- Return true if file name is absolute
bool isAbsolute() const;
//- Return true if file name is absolute
bool isAbsolute() const;
//- Convert from relative to absolute
fileName& toAbsolute();
// Decomposition
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment