POSIX: Unifying checking for ".gz" and ".orig" variants
This commit is contained in:
@ -887,7 +887,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Reading commands from file " << batchFile << endl;
|
||||
|
||||
// we cannot handle .gz files
|
||||
if (!isFile(batchFile, false))
|
||||
if (!isFile(batchFile, false, false))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot open file " << batchFile << exit(FatalError);
|
||||
|
||||
@ -456,7 +456,12 @@ bool Foam::chMod(const fileName& name, const mode_t m)
|
||||
}
|
||||
|
||||
|
||||
mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||
mode_t Foam::mode
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
@ -466,7 +471,7 @@ mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
fileStat fileStatus(name, followLink);
|
||||
fileStat fileStatus(name, checkVariants, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_mode;
|
||||
@ -478,13 +483,18 @@ mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||
Foam::fileName::Type Foam::type
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << endl;
|
||||
}
|
||||
mode_t m = mode(name, followLink);
|
||||
mode_t m = mode(name, checkVariants, followLink);
|
||||
|
||||
if (S_ISREG(m))
|
||||
{
|
||||
@ -508,20 +518,20 @@ Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||
bool Foam::exists
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkGzip:" << checkGzip
|
||||
<< endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkVariants:"
|
||||
<< bool(checkVariants) << " followLink:" << followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
return mode(name, followLink) || isFile(name, checkGzip, followLink);
|
||||
return mode(name, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
@ -529,51 +539,55 @@ bool Foam::isDir(const fileName& name, const bool followLink)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " followLink:"
|
||||
<< followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
return S_ISDIR(mode(name, followLink));
|
||||
return S_ISDIR(mode(name, false, followLink));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::isFile
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkGzip:" << checkGzip
|
||||
<< endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkVariants:"
|
||||
<< bool(checkVariants) << " followLink:" << followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
S_ISREG(mode(name, followLink))
|
||||
|| (checkGzip && S_ISREG(mode(name + ".gz", followLink)))
|
||||
|| (checkGzip && S_ISREG(mode(name + ".orig", followLink)));
|
||||
return S_ISREG(mode(name, checkVariants, followLink));
|
||||
}
|
||||
|
||||
|
||||
off_t Foam::fileSize(const fileName& name, const bool followLink)
|
||||
off_t Foam::fileSize
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkVariants:"
|
||||
<< bool(checkVariants) << " followLink:" << followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
fileStat fileStatus(name, followLink);
|
||||
fileStat fileStatus(name, checkVariants, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_size;
|
||||
@ -585,17 +599,23 @@ off_t Foam::fileSize(const fileName& name, const bool followLink)
|
||||
}
|
||||
|
||||
|
||||
time_t Foam::lastModified(const fileName& name, const bool followLink)
|
||||
time_t Foam::lastModified
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkVariants:"
|
||||
<< bool(checkVariants) << " followLink:" << followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
fileStat fileStatus(name, followLink);
|
||||
fileStat fileStatus(name, checkVariants, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_mtime;
|
||||
@ -607,17 +627,23 @@ time_t Foam::lastModified(const fileName& name, const bool followLink)
|
||||
}
|
||||
|
||||
|
||||
double Foam::highResLastModified(const fileName& name, const bool followLink)
|
||||
double Foam::highResLastModified
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << endl;
|
||||
Pout<< FUNCTION_NAME << " : name:" << name << " checkVariants:"
|
||||
<< bool(checkVariants) << " followLink:" << followLink << endl;
|
||||
if ((POSIX::debug & 2) && !Pstream::master())
|
||||
{
|
||||
error::printStack(Pout);
|
||||
}
|
||||
}
|
||||
fileStat fileStatus(name, followLink);
|
||||
fileStat fileStatus(name, checkVariants, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return
|
||||
@ -635,7 +661,7 @@ Foam::fileNameList Foam::readDir
|
||||
(
|
||||
const fileName& directory,
|
||||
const fileName::Type type,
|
||||
const bool filtergz,
|
||||
const bool filterVariants,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
@ -700,24 +726,25 @@ Foam::fileNameList Foam::readDir
|
||||
)
|
||||
)
|
||||
{
|
||||
if ((directory/fName).type(followLink) == type)
|
||||
if ((directory/fName).type(false, followLink) == type)
|
||||
{
|
||||
if (nEntries >= dirEntries.size())
|
||||
{
|
||||
dirEntries.setSize(dirEntries.size() + maxNnames);
|
||||
}
|
||||
|
||||
if (filtergz && fExt == "gz")
|
||||
dirEntries[nEntries++] = fName;
|
||||
|
||||
if (filterVariants)
|
||||
{
|
||||
dirEntries[nEntries++] = fName.lessExt();
|
||||
}
|
||||
else if (filtergz && fExt == "orig")
|
||||
{
|
||||
dirEntries[nEntries++] = fName.lessExt();
|
||||
}
|
||||
else
|
||||
{
|
||||
dirEntries[nEntries++] = fName;
|
||||
for (label i = 0; i < fileStat::nVariants_; ++ i)
|
||||
{
|
||||
if (fExt == fileStat::variantExts_[i])
|
||||
{
|
||||
dirEntries[nEntries - 1] = fName.lessExt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -750,7 +777,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
||||
return false;
|
||||
}
|
||||
|
||||
const fileName::Type srcType = src.type(followLink);
|
||||
const fileName::Type srcType = src.type(false, followLink);
|
||||
|
||||
fileName destFile(dest);
|
||||
|
||||
@ -949,7 +976,7 @@ bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink)
|
||||
if
|
||||
(
|
||||
dst.type() == fileName::DIRECTORY
|
||||
&& src.type(followLink) != fileName::DIRECTORY
|
||||
&& src.type(false, followLink) != fileName::DIRECTORY
|
||||
)
|
||||
{
|
||||
const fileName dstName(dst/src.name());
|
||||
@ -976,7 +1003,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext)
|
||||
}
|
||||
}
|
||||
|
||||
if (exists(src, false))
|
||||
if (exists(src, false, false))
|
||||
{
|
||||
const int maxIndex = 99;
|
||||
char index[3];
|
||||
@ -992,7 +1019,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext)
|
||||
|
||||
// avoid overwriting existing files, except for the last
|
||||
// possible index where we have no choice
|
||||
if (!exists(dstName, false) || n == maxIndex)
|
||||
if (!exists(dstName, false, false) || n == maxIndex)
|
||||
{
|
||||
return ::rename(src.c_str(), dstName.c_str()) == 0;
|
||||
}
|
||||
@ -1017,15 +1044,22 @@ bool Foam::rm(const fileName& file)
|
||||
}
|
||||
}
|
||||
|
||||
// Try returning plain file name; if not there, try with .gz
|
||||
// Try returning plain file name; if not there, try variants
|
||||
if (remove(file.c_str()) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
for (label i = 0; i < fileStat::nVariants_; ++ i)
|
||||
{
|
||||
return ::remove(string(file + ".gz").c_str()) == 0;
|
||||
const fileName fileVar = file + "." + fileStat::variantExts_[i];
|
||||
if (::remove(string(fileVar).c_str()) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1064,7 +1098,7 @@ bool Foam::rmDir(const fileName& directory)
|
||||
{
|
||||
fileName path = directory/fName;
|
||||
|
||||
if (path.type(false) == fileName::DIRECTORY)
|
||||
if (path.type(false, false) == fileName::DIRECTORY)
|
||||
{
|
||||
if (!rmDir(path))
|
||||
{
|
||||
|
||||
@ -31,6 +31,13 @@ License
|
||||
#include <unistd.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::fileStat::nVariants_ = 2;
|
||||
|
||||
const char* Foam::fileStat::variantExts_[] = {"gz", "orig"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileStat::fileStat()
|
||||
@ -42,6 +49,7 @@ Foam::fileStat::fileStat()
|
||||
Foam::fileStat::fileStat
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink,
|
||||
const unsigned int maxTime
|
||||
)
|
||||
@ -53,26 +61,22 @@ Foam::fileStat::fileStat
|
||||
|
||||
if (!timedOut(myTimer))
|
||||
{
|
||||
if (followLink)
|
||||
int (*getFileStatus)(const char *, struct stat *) =
|
||||
followLink ? ::stat : ::lstat;
|
||||
|
||||
if (getFileStatus(fName.c_str(), &status_) == 0)
|
||||
{
|
||||
if (::stat(fName.c_str(), &status_) != 0)
|
||||
{
|
||||
locIsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
locIsValid = true;
|
||||
}
|
||||
locIsValid = true;
|
||||
}
|
||||
else
|
||||
else if (checkVariants)
|
||||
{
|
||||
if (::lstat(fName.c_str(), &status_) != 0)
|
||||
for (label i = 0; !locIsValid && i < nVariants_; ++ i)
|
||||
{
|
||||
locIsValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
locIsValid = true;
|
||||
const fileName fNameVar = fName + "." + variantExts_[i];
|
||||
if (getFileStatus(fNameVar.c_str(), &status_) == 0)
|
||||
{
|
||||
locIsValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,6 +74,15 @@ class fileStat
|
||||
|
||||
public:
|
||||
|
||||
// Public static data
|
||||
|
||||
//- Number of file variants
|
||||
static const label nVariants_;
|
||||
|
||||
//- Extensions of the file variants
|
||||
static const char* variantExts_[];
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Empty constructor
|
||||
@ -85,6 +94,7 @@ public:
|
||||
fileStat
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true,
|
||||
const unsigned int maxTime = 0
|
||||
);
|
||||
|
||||
@ -55,7 +55,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
|
||||
// If the file is compressed, decompress it before reading.
|
||||
if (!ifPtr_->good())
|
||||
{
|
||||
if (isFile(pathname + ".gz", false))
|
||||
if (isFile(pathname + ".gz", false, false))
|
||||
{
|
||||
delete ifPtr_;
|
||||
|
||||
@ -71,7 +71,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
|
||||
compression_ = IOstream::COMPRESSED;
|
||||
}
|
||||
}
|
||||
else if (isFile(pathname + ".orig", false))
|
||||
else if (isFile(pathname + ".orig", false, false))
|
||||
{
|
||||
delete ifPtr_;
|
||||
|
||||
@ -174,8 +174,8 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
||||
{
|
||||
if (!good())
|
||||
{
|
||||
// also checks .gz file
|
||||
if (isFile(pathname_, true))
|
||||
// also checks variants
|
||||
if (isFile(pathname_, true, true))
|
||||
{
|
||||
check("IFstream::operator()");
|
||||
FatalIOError.exit();
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
|
||||
if (compression == IOstream::COMPRESSED)
|
||||
{
|
||||
// Get identically named uncompressed version out of the way
|
||||
fileName::Type pathType = Foam::type(pathname, false);
|
||||
fileName::Type pathType = Foam::type(pathname, false, false);
|
||||
if (pathType == fileName::FILE || pathType == fileName::LINK)
|
||||
{
|
||||
rm(pathname);
|
||||
@ -82,12 +82,16 @@ Foam::OFstreamAllocator::OFstreamAllocator
|
||||
{
|
||||
// get identically named compressed version out of the way
|
||||
fileName gzPathName(pathname + ".gz");
|
||||
fileName::Type gzType = Foam::type(gzPathName, false);
|
||||
fileName::Type gzType = Foam::type(gzPathName, false, false);
|
||||
if (gzType == fileName::FILE || gzType == fileName::LINK)
|
||||
{
|
||||
rm(gzPathName);
|
||||
}
|
||||
if (!append && Foam::type(pathname, false) == fileName::LINK)
|
||||
if
|
||||
(
|
||||
!append
|
||||
&& Foam::type(pathname, false, false) == fileName::LINK
|
||||
)
|
||||
{
|
||||
// Disallow writing into softlink to avoid any problems with
|
||||
// e.g. softlinked initial fields
|
||||
|
||||
@ -162,7 +162,7 @@ void Foam::Time::setControls()
|
||||
|
||||
// Check if time directory exists
|
||||
// If not increase time precision to see if it is formatted differently.
|
||||
if (!fileHandler().exists(timePath(), false))
|
||||
if (!fileHandler().exists(timePath(), false, false))
|
||||
{
|
||||
int oldPrecision = precision_;
|
||||
int requiredPrecision = -1;
|
||||
@ -186,7 +186,7 @@ void Foam::Time::setControls()
|
||||
oldTime = newTime;
|
||||
|
||||
// Check the existence of the time directory with the new format
|
||||
found = fileHandler().exists(timePath(), false);
|
||||
found = fileHandler().exists(timePath(), false, false);
|
||||
|
||||
if (found)
|
||||
{
|
||||
|
||||
@ -157,7 +157,7 @@ bool Foam::dynamicCode::resolveTemplates
|
||||
if (!templateDir.empty() && isDir(templateDir))
|
||||
{
|
||||
file = templateDir/templateName;
|
||||
if (!isFile(file, false))
|
||||
if (!isFile(file, false, false))
|
||||
{
|
||||
file.clear();
|
||||
}
|
||||
@ -512,7 +512,7 @@ bool Foam::dynamicCode::upToDate(const SHA1Digest& sha1) const
|
||||
{
|
||||
const fileName file = digestFile();
|
||||
|
||||
if (!exists(file, false) || SHA1Digest(IFstream(file)()) != sha1)
|
||||
if (!exists(file, false, false) || SHA1Digest(IFstream(file)()) != sha1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -198,6 +198,7 @@ public:
|
||||
virtual mode_t mode
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -205,6 +206,7 @@ public:
|
||||
virtual fileName::Type type
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -213,7 +215,7 @@ public:
|
||||
virtual bool exists
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -229,7 +231,7 @@ public:
|
||||
virtual bool isFile
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -237,6 +239,7 @@ public:
|
||||
virtual off_t fileSize
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -244,6 +247,7 @@ public:
|
||||
virtual time_t lastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -251,6 +255,7 @@ public:
|
||||
virtual double highResLastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
@ -259,7 +264,7 @@ public:
|
||||
(
|
||||
const fileName&,
|
||||
const fileName::Type=fileName::FILE,
|
||||
const bool filtergz=true,
|
||||
const bool filterVariants = true,
|
||||
const bool followLink = true
|
||||
) const = 0;
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ License
|
||||
#include "SubList.H"
|
||||
#include "unthreadedInitialise.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "gzstream.h"
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
@ -496,25 +497,28 @@ bool Foam::fileOperations::masterUncollatedFileOperation::uniformFile
|
||||
void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
(
|
||||
const fileName& filePath,
|
||||
const IOstream::compressionType cmp,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
)
|
||||
{
|
||||
if (cmp == IOstream::compressionType::COMPRESSED)
|
||||
if (debug)
|
||||
{
|
||||
Pout<< FUNCTION_NAME << ": Opening " << filePath << endl;
|
||||
}
|
||||
|
||||
IFstream is(filePath, IOstream::streamFormat::BINARY);
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
FatalIOErrorInFunction(filePath) << "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (isA<igzstream>(is.stdStream()))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::readAndSend :"
|
||||
<< " Opening compressed " << filePath << endl;
|
||||
}
|
||||
|
||||
IFstream is(filePath, IOstream::streamFormat::BINARY);
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
FatalIOErrorInFunction(filePath) << "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
Pout<< FUNCTION_NAME << ": Reading compressed" << endl;
|
||||
}
|
||||
|
||||
std::ostringstream stringStr;
|
||||
@ -530,21 +534,12 @@ void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
else
|
||||
{
|
||||
off_t count(Foam::fileSize(filePath));
|
||||
IFstream is(filePath, IOstream::streamFormat::BINARY);
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
FatalIOErrorInFunction(filePath) << "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::readStream :"
|
||||
<< " From " << filePath << " reading " << label(count)
|
||||
<< " bytes" << endl;
|
||||
Pout<< FUNCTION_NAME << " : Reading " << count << " bytes " << endl;
|
||||
}
|
||||
|
||||
List<char> buf(static_cast<label>(count));
|
||||
is.stdStream().read(buf.begin(), count);
|
||||
|
||||
@ -557,36 +552,6 @@ void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
}
|
||||
|
||||
|
||||
void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
(
|
||||
const fileName& fName,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
)
|
||||
{
|
||||
if (Foam::exists(fName+".gz", false))
|
||||
{
|
||||
readAndSend
|
||||
(
|
||||
fName,
|
||||
IOstream::compressionType::COMPRESSED,
|
||||
procs,
|
||||
pBufs
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
readAndSend
|
||||
(
|
||||
fName,
|
||||
IOstream::compressionType::UNCOMPRESSED,
|
||||
procs,
|
||||
pBufs
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::ISstream>
|
||||
Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
(
|
||||
@ -910,13 +875,14 @@ bool Foam::fileOperations::masterUncollatedFileOperation::chMod
|
||||
mode_t Foam::fileOperations::masterUncollatedFileOperation::mode
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<mode_t, modeOp>
|
||||
(
|
||||
fName,
|
||||
modeOp(followLink),
|
||||
modeOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -926,6 +892,7 @@ mode_t Foam::fileOperations::masterUncollatedFileOperation::mode
|
||||
Foam::fileName::Type Foam::fileOperations::masterUncollatedFileOperation::type
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
@ -934,7 +901,7 @@ Foam::fileName::Type Foam::fileOperations::masterUncollatedFileOperation::type
|
||||
masterOp<label, typeOp>
|
||||
(
|
||||
fName,
|
||||
typeOp(followLink),
|
||||
typeOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
)
|
||||
@ -945,14 +912,14 @@ Foam::fileName::Type Foam::fileOperations::masterUncollatedFileOperation::type
|
||||
bool Foam::fileOperations::masterUncollatedFileOperation::exists
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<bool, existsOp>
|
||||
(
|
||||
fName,
|
||||
existsOp(checkGzip, followLink),
|
||||
existsOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -978,14 +945,14 @@ bool Foam::fileOperations::masterUncollatedFileOperation::isDir
|
||||
bool Foam::fileOperations::masterUncollatedFileOperation::isFile
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<bool, isFileOp>
|
||||
(
|
||||
fName,
|
||||
isFileOp(checkGzip, followLink),
|
||||
isFileOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -995,13 +962,14 @@ bool Foam::fileOperations::masterUncollatedFileOperation::isFile
|
||||
off_t Foam::fileOperations::masterUncollatedFileOperation::fileSize
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<off_t, fileSizeOp>
|
||||
(
|
||||
fName,
|
||||
fileSizeOp(followLink),
|
||||
fileSizeOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -1011,13 +979,14 @@ off_t Foam::fileOperations::masterUncollatedFileOperation::fileSize
|
||||
time_t Foam::fileOperations::masterUncollatedFileOperation::lastModified
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<time_t, lastModifiedOp>
|
||||
(
|
||||
fName,
|
||||
lastModifiedOp(followLink),
|
||||
lastModifiedOp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -1027,13 +996,14 @@ time_t Foam::fileOperations::masterUncollatedFileOperation::lastModified
|
||||
double Foam::fileOperations::masterUncollatedFileOperation::highResLastModified
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return masterOp<double, lastModifiedHROp>
|
||||
(
|
||||
fName,
|
||||
lastModifiedHROp(followLink),
|
||||
lastModifiedHROp(checkVariants, followLink),
|
||||
Pstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
@ -2415,13 +2385,6 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
<< " Opening global file " << filePath << endl;
|
||||
}
|
||||
|
||||
IOstream::compressionType cmp
|
||||
(
|
||||
Foam::exists(filePath+".gz", false)
|
||||
? IOstream::compressionType::COMPRESSED
|
||||
: IOstream::compressionType::UNCOMPRESSED
|
||||
);
|
||||
|
||||
labelList procs(Pstream::nProcs(Pstream::worldComm)-1);
|
||||
for
|
||||
(
|
||||
@ -2433,7 +2396,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
procs[proci-1] = proci;
|
||||
}
|
||||
|
||||
readAndSend(filePath, cmp, procs, pBufs);
|
||||
readAndSend(filePath, procs, pBufs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2444,20 +2407,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
proci++
|
||||
)
|
||||
{
|
||||
IOstream::compressionType cmp
|
||||
(
|
||||
Foam::exists(filePaths[proci]+".gz", false)
|
||||
? IOstream::compressionType::COMPRESSED
|
||||
: IOstream::compressionType::UNCOMPRESSED
|
||||
);
|
||||
|
||||
readAndSend
|
||||
(
|
||||
filePaths[proci],
|
||||
cmp,
|
||||
labelList(1, proci),
|
||||
pBufs
|
||||
);
|
||||
readAndSend(filePaths[proci], labelList(1, proci), pBufs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,48 +128,52 @@ protected:
|
||||
|
||||
class modeOp
|
||||
{
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
modeOp(const bool followLink)
|
||||
modeOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
mode_t operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::mode(fName, followLink_);
|
||||
return Foam::mode(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
class typeOp
|
||||
{
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
typeOp(const bool followLink)
|
||||
typeOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
label operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::type(fName, followLink_);
|
||||
return Foam::type(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
class existsOp
|
||||
{
|
||||
const bool checkGzip_;
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
existsOp(const bool checkGzip, const bool followLink)
|
||||
existsOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkGzip_(checkGzip),
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
bool operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::exists(fName, checkGzip_, followLink_);
|
||||
return Foam::exists(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
@ -191,66 +195,82 @@ protected:
|
||||
|
||||
class isFileOp
|
||||
{
|
||||
const bool checkGzip_;
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
isFileOp(const bool checkGzip, const bool followLink)
|
||||
isFileOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkGzip_(checkGzip),
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
public:
|
||||
bool operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::isFile(fName, checkGzip_, followLink_);
|
||||
return Foam::isFile(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
class fileSizeOp
|
||||
{
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
fileSizeOp(const bool followLink)
|
||||
fileSizeOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
public:
|
||||
off_t operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::fileSize(fName, followLink_);
|
||||
return Foam::fileSize(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
class lastModifiedOp
|
||||
{
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
lastModifiedOp(const bool followLink)
|
||||
lastModifiedOp(const bool checkVariants, const bool followLink)
|
||||
:
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
public:
|
||||
time_t operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::lastModified(fName, followLink_);
|
||||
return Foam::lastModified(fName, checkVariants_, followLink_);
|
||||
}
|
||||
};
|
||||
|
||||
class lastModifiedHROp
|
||||
{
|
||||
const bool checkVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
lastModifiedHROp(const bool followLink)
|
||||
lastModifiedHROp
|
||||
(
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
)
|
||||
:
|
||||
checkVariants_(checkVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
public:
|
||||
double operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::highResLastModified(fName, followLink_);
|
||||
return
|
||||
Foam::highResLastModified
|
||||
(
|
||||
fName,
|
||||
checkVariants_,
|
||||
followLink_
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -352,24 +372,31 @@ protected:
|
||||
class readDirOp
|
||||
{
|
||||
const fileName::Type type_;
|
||||
const bool filtergz_;
|
||||
const bool filterVariants_;
|
||||
const bool followLink_;
|
||||
public:
|
||||
readDirOp
|
||||
(
|
||||
const fileName::Type type,
|
||||
const bool filtergz,
|
||||
const bool filterVariants,
|
||||
const bool followLink
|
||||
)
|
||||
:
|
||||
type_(type),
|
||||
filtergz_(filtergz),
|
||||
filterVariants_(filterVariants),
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
fileNameList operator()(const fileName& fName) const
|
||||
{
|
||||
return Foam::readDir(fName, type_, filtergz_, followLink_);
|
||||
return
|
||||
Foam::readDir
|
||||
(
|
||||
fName,
|
||||
type_,
|
||||
filterVariants_,
|
||||
followLink_
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -434,15 +461,6 @@ protected:
|
||||
const word& instancePath
|
||||
) const;
|
||||
|
||||
//- Read file contents and send to processors
|
||||
static void readAndSend
|
||||
(
|
||||
const fileName& filePath,
|
||||
const IOstream::compressionType cmp,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
);
|
||||
|
||||
//- Detect file (possibly compressed), read file contents and send
|
||||
// to processors
|
||||
static void readAndSend
|
||||
@ -508,6 +526,7 @@ public:
|
||||
virtual mode_t mode
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -515,6 +534,7 @@ public:
|
||||
virtual fileName::Type type
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -523,7 +543,7 @@ public:
|
||||
virtual bool exists
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -539,7 +559,7 @@ public:
|
||||
virtual bool isFile
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -547,6 +567,7 @@ public:
|
||||
virtual off_t fileSize
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -554,6 +575,7 @@ public:
|
||||
virtual time_t lastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -561,6 +583,7 @@ public:
|
||||
virtual double highResLastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -569,7 +592,7 @@ public:
|
||||
(
|
||||
const fileName&,
|
||||
const fileName::Type=fileName::FILE,
|
||||
const bool filtergz=true,
|
||||
const bool filterVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -206,31 +206,33 @@ bool Foam::fileOperations::uncollatedFileOperation::chMod
|
||||
mode_t Foam::fileOperations::uncollatedFileOperation::mode
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::mode(fName, followLink);
|
||||
return Foam::mode(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName::Type Foam::fileOperations::uncollatedFileOperation::type
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::type(fName, followLink);
|
||||
return Foam::type(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fileOperations::uncollatedFileOperation::exists
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::exists(fName, checkGzip, followLink);
|
||||
return Foam::exists(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
@ -247,41 +249,44 @@ bool Foam::fileOperations::uncollatedFileOperation::isDir
|
||||
bool Foam::fileOperations::uncollatedFileOperation::isFile
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkGzip,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::isFile(fName, checkGzip, followLink);
|
||||
return Foam::isFile(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
off_t Foam::fileOperations::uncollatedFileOperation::fileSize
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::fileSize(fName, followLink);
|
||||
return Foam::fileSize(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
time_t Foam::fileOperations::uncollatedFileOperation::lastModified
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::lastModified(fName, followLink);
|
||||
return Foam::lastModified(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
double Foam::fileOperations::uncollatedFileOperation::highResLastModified
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return Foam::highResLastModified(fName, followLink);
|
||||
return Foam::highResLastModified(fName, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ public:
|
||||
virtual mode_t mode
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -100,6 +101,7 @@ public:
|
||||
virtual fileName::Type type
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -108,7 +110,7 @@ public:
|
||||
virtual bool exists
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -124,7 +126,7 @@ public:
|
||||
virtual bool isFile
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -132,6 +134,7 @@ public:
|
||||
virtual off_t fileSize
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -139,6 +142,7 @@ public:
|
||||
virtual time_t lastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
@ -146,6 +150,7 @@ public:
|
||||
virtual double highResLastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -100,17 +100,27 @@ bool mkDir(const fileName&, mode_t=0777);
|
||||
bool chMod(const fileName&, const mode_t);
|
||||
|
||||
//- Return the file mode
|
||||
mode_t mode(const fileName&, const bool followLink = true);
|
||||
mode_t mode
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Return the file type: DIRECTORY or FILE
|
||||
fileName::Type type(const fileName&, const bool followLink = true);
|
||||
fileName::Type type
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Does the name exist (as DIRECTORY or FILE) in the file system?
|
||||
// Optionally enable/disable check for gzip file.
|
||||
// Optionally enable/disable check for variant files.
|
||||
bool exists
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
@ -118,29 +128,44 @@ bool exists
|
||||
bool isDir(const fileName&, const bool followLink = true);
|
||||
|
||||
//- Does the name exist as a FILE in the file system?
|
||||
// Optionally enable/disable check for gzip file.
|
||||
// Optionally enable/disable check for variant files.
|
||||
bool isFile
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkGzip=true,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Return size of file
|
||||
off_t fileSize(const fileName&, const bool followLink = true);
|
||||
off_t fileSize
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Return time of last file modification
|
||||
time_t lastModified(const fileName&, const bool followLink = true);
|
||||
time_t lastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Return time of last file modification
|
||||
double highResLastModified(const fileName&, const bool followLink = true);
|
||||
double highResLastModified
|
||||
(
|
||||
const fileName&,
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
//- Read a directory and return the entries as a string list
|
||||
fileNameList readDir
|
||||
(
|
||||
const fileName&,
|
||||
const fileName::Type=fileName::FILE,
|
||||
const bool filtergz=true,
|
||||
const bool filterVariants = true,
|
||||
const bool followLink = true
|
||||
);
|
||||
|
||||
|
||||
@ -48,9 +48,13 @@ Foam::fileName::fileName(const wordList& lst)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName::Type Foam::fileName::type(const bool followLink) const
|
||||
Foam::fileName::Type Foam::fileName::type
|
||||
(
|
||||
const bool checkVariants,
|
||||
const bool followLink
|
||||
) const
|
||||
{
|
||||
return ::Foam::type(*this, followLink);
|
||||
return ::Foam::type(*this, checkVariants, followLink);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -156,7 +156,11 @@ public:
|
||||
|
||||
//- Return the file type: FILE, DIRECTORY, UNDEFINED or
|
||||
// LINK (only if followLink=false)
|
||||
Type type(const bool followLink = true) const;
|
||||
Type type
|
||||
(
|
||||
const bool checkVariants = true,
|
||||
const bool followLink = true
|
||||
) const;
|
||||
|
||||
//- Return true if file name is absolute
|
||||
bool isAbsolute() const;
|
||||
|
||||
@ -43,7 +43,7 @@ bool Foam::triSurface::readSTLBINARY(const fileName& STLfileName)
|
||||
);
|
||||
|
||||
// If the file is compressed, decompress it before reading.
|
||||
if (!STLfilePtr->good() && isFile(STLfileName + ".gz", false))
|
||||
if (!STLfilePtr->good() && isFile(STLfileName + ".gz", false, false))
|
||||
{
|
||||
compressed = true;
|
||||
STLfilePtr.reset(new igzstream((STLfileName + ".gz").c_str()));
|
||||
|
||||
Reference in New Issue
Block a user