Foam::findEtcFile - avoid false positives on directories

- use isFile() instead of exists() for file-checking
This commit is contained in:
Mark Olesen
2009-05-18 10:27:32 +02:00
parent 20c1a673e7
commit 06517656e8

View File

@ -222,14 +222,14 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
{
// Check for user file in ~/.OpenFOAM/VERSION
fileName fullName = searchDir/FOAMversion/name;
if (exists(fullName))
if (isFile(fullName))
{
return fullName;
}
// Check for version-independent user file in ~/.OpenFOAM
fullName = searchDir/name;
if (exists(fullName))
if (isFile(fullName))
{
return fullName;
}
@ -243,14 +243,14 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
{
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
fileName fullName = searchDir/"site"/FOAMversion/name;
if (exists(fullName))
if (isFile(fullName))
{
return fullName;
}
// Check for version-independent site file in $WM_PROJECT_INST_DIR/site
fullName = searchDir/"site"/name;
if (exists(fullName))
if (isFile(fullName))
{
return fullName;
}
@ -263,7 +263,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
{
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fileName fullName = searchDir/"etc"/name;
if (exists(fullName))
if (isFile(fullName))
{
return fullName;
}