diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index d444b83a0b64522207dfec51fb9e88dc8bca2c2d..f4cad0fccb8a49bc62fe0ec48993ffb12d0be7f4 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -770,7 +770,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink) // If dest is a directory, create the destination file name. if (destFile.type() == fileName::DIRECTORY) { - destFile = destFile/src.component(src.components().size() -1); + destFile = destFile/src.components().last(); } // Make sure the destination directory exists.