CPack: Fix symbolic link detection for directories
In the case where the current path is a symlink to a directory, a trailing slash causes the link to be dereferenced, which means that any subsequent FileIsSymlink on it will return false.
Fixes: #21886 (closed)