mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
fileOperation: Corrected processor counting for moving mesh cases
This commit is contained in:
committed by
Andrew Heather
parent
fdf08c401f
commit
bed8dd4bc7
@ -884,6 +884,32 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
||||
return false;
|
||||
}
|
||||
|
||||
char* realSrcPath = realpath(src.c_str(), nullptr);
|
||||
char* realDestPath = realpath(destFile.c_str(), nullptr);
|
||||
const bool samePath = strcmp(realSrcPath, realDestPath) == 0;
|
||||
|
||||
if (POSIX::debug && samePath)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Attempt to copy " << realSrcPath << " to itself" << endl;
|
||||
}
|
||||
|
||||
if (realSrcPath)
|
||||
{
|
||||
free(realSrcPath);
|
||||
}
|
||||
|
||||
if (realDestPath)
|
||||
{
|
||||
free(realDestPath);
|
||||
}
|
||||
|
||||
// Do not copy over self when src is actually a link to dest
|
||||
if (samePath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy files
|
||||
fileNameList contents = readDir(src, fileName::FILE, false, followLink);
|
||||
forAll(contents, i)
|
||||
|
||||
Reference in New Issue
Block a user