From 359f14ae919c7179a47a27af254138108ee349a4 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Mon, 20 Jul 2009 08:48:46 +0200 Subject: [PATCH] pass optional checkGzip through POSIX::exists() as well --- src/OSspecific/POSIX/POSIX.C | 24 +++++++++---------- src/OpenFOAM/include/OSspecific.H | 3 ++- .../fvMeshDistribute/fvMeshDistribute.C | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 09b3182b520..8496225b29a 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -474,20 +474,20 @@ Foam::fileName::Type Foam::type(const fileName& name) // Does the name exist in the filing system? -bool Foam::exists(const fileName& name) +bool Foam::exists(const fileName& name, const bool checkGzip) { - return mode(name) || isFile(name); + return mode(name) || isFile(name, checkGzip); } -// Does the directory exist +// Does the directory exist? bool Foam::isDir(const fileName& name) { return S_ISDIR(mode(name)); } -// Does the file exist +// Does the file exist? bool Foam::isFile(const fileName& name, const bool checkGzip) { return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz"))); @@ -757,31 +757,31 @@ bool Foam::ln(const fileName& src, const fileName& dst) // Rename srcFile dstFile -bool Foam::mv(const fileName& srcFile, const fileName& dstFile) +bool Foam::mv(const fileName& src, const fileName& dst) { if (POSIX::debug) { - Info<< "Move : " << srcFile << " to " << dstFile << endl; + Info<< "Move : " << src << " to " << dst << endl; } if ( - dstFile.type() == fileName::DIRECTORY - && srcFile.type() != fileName::DIRECTORY + dst.type() == fileName::DIRECTORY + && src.type() != fileName::DIRECTORY ) { - const fileName dstName(dstFile/srcFile.name()); + const fileName dstName(dst/src.name()); - return rename(srcFile.c_str(), dstName.c_str()) == 0; + return rename(src.c_str(), dstName.c_str()) == 0; } else { - return rename(srcFile.c_str(), dstFile.c_str()) == 0; + return rename(src.c_str(), dst.c_str()) == 0; } } -// Remove a file returning true if successful otherwise false +// Remove a file, returning true if successful otherwise false bool Foam::rm(const fileName& file) { if (POSIX::debug) diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index d04243c23db..946cf0f86da 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -119,7 +119,8 @@ mode_t mode(const fileName&); fileName::Type type(const fileName&); //- Does the name exist (as DIRECTORY or FILE) in the file system? -bool exists(const fileName&); +// Optionally enable/disable check for gzip file. +bool exists(const fileName&, const bool checkGzip=true); //- Does the name exist as a DIRECTORY in the file system? bool isDir(const fileName&); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 74993262d4e..633c39f4782 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -928,7 +928,7 @@ Foam::labelList Foam::fvMeshDistribute::mapBoundaryData { label newFaceI = map.oldFaceMap()[oldBFaceI + map.nOldInternalFaces()]; - // Face still exists (is nessecary?) and still boundary face + // Face still exists (is necessary?) and still boundary face if (newFaceI >= 0 && newFaceI >= mesh.nInternalFaces()) { newBoundaryData[newFaceI - mesh.nInternalFaces()] = -- GitLab