summaryrefslogtreecommitdiffstats
path: root/Source/cmFileAPICodemodel.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-14 16:57:06 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-17 14:02:16 (GMT)
commit5b3a71a83faf913aa4a9644779ae35c9d5eda733 (patch)
tree03c012dd1fa62ba1330e4c064bf6a8069aa5266f /Source/cmFileAPICodemodel.cxx
parentea9b1d36b8cdf384903021d41ca665848895480f (diff)
downloadCMake-5b3a71a83faf913aa4a9644779ae35c9d5eda733.zip
CMake-5b3a71a83faf913aa4a9644779ae35c9d5eda733.tar.gz
CMake-5b3a71a83faf913aa4a9644779ae35c9d5eda733.tar.bz2
cmSystemTools: Adopt RelativeIfUnder helper
This returns a relative path if it does not start in `../`.
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r--Source/cmFileAPICodemodel.cxx10
1 files changed, 1 insertions, 9 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 6b8757c..6b35842 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -57,15 +57,7 @@ using TargetIndexMapType =
std::string RelativeIfUnder(std::string const& top, std::string const& in)
{
- std::string out;
- if (in == top) {
- out = ".";
- } else if (cmSystemTools::IsSubDirectory(in, top)) {
- out = in.substr(top.size() + 1);
- } else {
- out = in;
- }
- return out;
+ return cmSystemTools::RelativeIfUnder(top, in);
}
class JBTIndex