mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
pass optional checkGzip through POSIX::exists() as well
This commit is contained in:
@ -474,20 +474,20 @@ Foam::fileName::Type Foam::type(const fileName& name)
|
|||||||
|
|
||||||
|
|
||||||
// Does the name exist in the filing system?
|
// 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)
|
bool Foam::isDir(const fileName& name)
|
||||||
{
|
{
|
||||||
return S_ISDIR(mode(name));
|
return S_ISDIR(mode(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Does the file exist
|
// Does the file exist?
|
||||||
bool Foam::isFile(const fileName& name, const bool checkGzip)
|
bool Foam::isFile(const fileName& name, const bool checkGzip)
|
||||||
{
|
{
|
||||||
return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz")));
|
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
|
// Rename srcFile dstFile
|
||||||
bool Foam::mv(const fileName& srcFile, const fileName& dstFile)
|
bool Foam::mv(const fileName& src, const fileName& dst)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
{
|
{
|
||||||
Info<< "Move : " << srcFile << " to " << dstFile << endl;
|
Info<< "Move : " << src << " to " << dst << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
dstFile.type() == fileName::DIRECTORY
|
dst.type() == fileName::DIRECTORY
|
||||||
&& srcFile.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
|
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)
|
bool Foam::rm(const fileName& file)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
|
|||||||
@ -119,7 +119,8 @@ mode_t mode(const fileName&);
|
|||||||
fileName::Type type(const fileName&);
|
fileName::Type type(const fileName&);
|
||||||
|
|
||||||
//- Does the name exist (as DIRECTORY or FILE) in the file system?
|
//- 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?
|
//- Does the name exist as a DIRECTORY in the file system?
|
||||||
bool isDir(const fileName&);
|
bool isDir(const fileName&);
|
||||||
|
|||||||
@ -928,7 +928,7 @@ Foam::labelList Foam::fvMeshDistribute::mapBoundaryData
|
|||||||
{
|
{
|
||||||
label newFaceI = map.oldFaceMap()[oldBFaceI + map.nOldInternalFaces()];
|
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())
|
if (newFaceI >= 0 && newFaceI >= mesh.nInternalFaces())
|
||||||
{
|
{
|
||||||
newBoundaryData[newFaceI - mesh.nInternalFaces()] =
|
newBoundaryData[newFaceI - mesh.nInternalFaces()] =
|
||||||
|
|||||||
Reference in New Issue
Block a user