summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-05 16:30:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-11-05 16:30:27 (GMT)
commitcb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5 (patch)
treefff2895e42c8b994a8b8fafccc72e57d5f19a3d9 /Source
parenta269c77edb7c9d55efa1fbac46ed84173a7dcbc9 (diff)
parent3c0ca5a9d9d538da41e99207da22f55496bdf553 (diff)
downloadCMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.zip
CMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.tar.gz
CMake-cb165b8b79c96a3ff6db12cb1821cfa2c0c4cce5.tar.bz2
Merge topic 'source_group-tree'
3c0ca5a9d9 source_group: ensure that passed file is not a directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3979
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSourceGroupCommand.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 3a13e57..cc62952 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -78,10 +78,18 @@ std::vector<std::string> prepareFilesPathsForTree(
for (auto const& filePath : filesPaths) {
std::string fullPath =
cmSystemTools::CollapseFullPath(filePath, currentSourceDir);
- // If provided file path is actually not a file, silently ignore it.
- if (cmSystemTools::FileExists(fullPath, /*isFile=*/true)) {
- prepared.emplace_back(std::move(fullPath));
+ // If provided file path is actually not a directory, silently ignore it.
+ if (cmSystemTools::FileIsDirectory(fullPath)) {
+ continue;
}
+
+ // Handle directory that doesn't exist yet.
+ if (!fullPath.empty() &&
+ (fullPath.back() == '/' || fullPath.back() == '\\')) {
+ continue;
+ }
+
+ prepared.emplace_back(std::move(fullPath));
}
return prepared;