mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Foam::cp inadvertently creates recursive directories (fixes #2235)
- noticed by Robin Knowles with `decomposePar -fields -copyZero`
The internals for the Foam:cp method combine the behaviour of
a regular `cp` and `cp -R` combined.
When source and target are both directories, the old implementation
created a subdirectory for the contents.
This normally fine,
ok: cp "path1/0/" to "path2/1" -> "path2/1/2"
BUT: cp "path1/0/" to "path2/0" -> "path2/0/0" !!
Now add check for the basenames first.
If they are identical, we probably meant to copy directory contents
only, without the additional subdir layer.
BUG: decomposePar -fields -copyZero copies the wrong directory
- was using the current time name (usually latest) instead of copying
the 0 directory
ENH: accept 0.orig directories as a fallback to copy if the 0 directory
is missing
This commit is contained in:
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||
// Back-up old optimisationDict, to maintain potential comments in it
|
||||
if (Pstream::master())
|
||||
{
|
||||
cp(optDict.objectPath(), optDict.objectPath() + ".org");
|
||||
Foam::cp(optDict.objectPath(), optDict.objectPath() + ".org");
|
||||
}
|
||||
|
||||
// Construct mesh movement object and grab active design variables
|
||||
|
||||
Reference in New Issue
Block a user