Skip to content
  • Mark OLESEN's avatar
    BUG: Foam::cp inadvertently creates recursive directories (fixes #2235) · fe8c6309
    Mark OLESEN authored
    - 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
    fe8c6309