Browse Source

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
Olivier Iffrig 4 years ago
parent
commit
c456b09513
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Source/CPack/cmCPackGenerator.cxx

+ 2 - 1
Source/CPack/cmCPackGenerator.cxx

@@ -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) {