Skip to content

Commit 7d98cd0

Browse files
committed
Merge branch 'source_group-tree-files' into release-3.15
Merge-request: !3630
2 parents 4053d57 + 93af8a2 commit 7d98cd0

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Source/cmSourceGroupCommand.cxx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ bool rootIsPrefix(const std::string& root,
6363
return true;
6464
}
6565

66-
std::string prepareFilePathForTree(const std::string& path,
67-
const std::string& currentSourceDir)
68-
{
69-
if (!cmSystemTools::FileIsFullPath(path)) {
70-
return cmSystemTools::CollapseFullPath(currentSourceDir + "/" + path);
71-
}
72-
return cmSystemTools::CollapseFullPath(path);
73-
}
74-
7566
std::vector<std::string> prepareFilesPathsForTree(
7667
const std::vector<std::string>& filesPaths,
7768
const std::string& currentSourceDir)
@@ -80,9 +71,11 @@ std::vector<std::string> prepareFilesPathsForTree(
8071
prepared.reserve(filesPaths.size());
8172

8273
for (auto const& filePath : filesPaths) {
74+
std::string fullPath =
75+
cmSystemTools::CollapseFullPath(filePath, currentSourceDir);
8376
// If provided file path is actually not a file, silently ignore it.
84-
if (cmSystemTools::FileExists(filePath, /*isFile=*/true)) {
85-
prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
77+
if (cmSystemTools::FileExists(fullPath, /*isFile=*/true)) {
78+
prepared.emplace_back(std::move(fullPath));
8679
}
8780
}
8881

0 commit comments

Comments
 (0)