mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
OSspecific: altered file tests
- removed the previously added fileName type(), isDir(), isFile() methods. - added optional bool parameter to isFile() function to explicitly enable/disable the check for gzip files. - fixed minor bugginess where the default usage of isFile() would result in false positive matches. - be slightly more stringent and use isDir() and isFile() instead of exists() function when we actually know the expected type.
This commit is contained in:
@ -615,7 +615,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fileName ccmFile(args.additionalArgs()[0]);
|
||||
|
||||
if (!exists(ccmFile))
|
||||
if (!isFile(ccmFile))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot read file " << ccmFile
|
||||
|
||||
@ -129,14 +129,14 @@ int main(int argc, char *argv[])
|
||||
Info<< "Reading .face file for boundary information" << nl << endl;
|
||||
}
|
||||
|
||||
if (!exists(nodeFile) || !exists(eleFile))
|
||||
if (!isFile(nodeFile) || !isFile(eleFile))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot read " << nodeFile << " or " << eleFile
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (readFaceFile && !exists(faceFile))
|
||||
if (readFaceFile && !isFile(faceFile))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot read " << faceFile << endl
|
||||
|
||||
@ -108,7 +108,11 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
new IOobject
|
||||
(
|
||||
( dictPath.isDir() ? dictPath/dictName : dictPath ),
|
||||
(
|
||||
isDir(dictPath)
|
||||
? dictPath/dictName
|
||||
: dictPath
|
||||
),
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
|
||||
@ -746,7 +746,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Pout<< "Reading commands from file " << batchFile << endl;
|
||||
|
||||
if (!exists(batchFile))
|
||||
// we also cannot handle .gz files
|
||||
if (!isFile(batchFile, false))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot open file " << batchFile << exit(FatalError);
|
||||
|
||||
@ -627,7 +627,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
Info<< "Testing:" << io.objectPath() << endl;
|
||||
|
||||
if (!io.headerOk())
|
||||
//if (!exists(io.objectPath()))
|
||||
// if (!exists(io.objectPath()))
|
||||
{
|
||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||
dictionary dummyDict;
|
||||
|
||||
Reference in New Issue
Block a user