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
This commit is contained in:
Olivier Iffrig
2021-03-05 08:21:13 -05:00
committed by Brad King
parent 1dde7e350a
commit c456b09513
+2 -1
View File
@@ -384,7 +384,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
for (std::string const& gf : this->files) {
bool skip = false;
std::string inFile = gf;
if (cmSystemTools::FileIsDirectory(gf)) {
if (cmSystemTools::FileIsDirectory(gf) &&
!cmSystemTools::FileIsSymlink(gf)) {
inFile += '/';
}
for (cmsys::RegularExpression& reg : ignoreFilesRegex) {