summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-04 15:24:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-11-04 15:24:31 (GMT)
commitabac3a31a2caba00e56db917cebaae8e47ffeefd (patch)
treee29048984d6c30f5cc37a4b6e8af244328b7efe3 /Source
parentb30701f04500b44810ec1413fe787a0c88a98c41 (diff)
parent0692eaf0fe00fd4bd90c2a4f107356b2bc0f9d99 (diff)
downloadCMake-abac3a31a2caba00e56db917cebaae8e47ffeefd.zip
CMake-abac3a31a2caba00e56db917cebaae8e47ffeefd.tar.gz
CMake-abac3a31a2caba00e56db917cebaae8e47ffeefd.tar.bz2
Merge topic 'root-dir-assertion-fix'
0692eaf0fe ForceToRelativePath: Fix spurious assertion when local path is root dir Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3976
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a50e829..c4a4220 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1120,8 +1120,13 @@ std::string cmSystemTools::ForceToRelativePath(std::string const& local_path,
assert(local_path.front() != '\"');
assert(remote_path.front() != '\"');
- // The local path should never have a trailing slash.
- assert(local_path.empty() || local_path.back() != '/');
+ // The local path should never have a trailing slash except if it is just the
+ // bare root directory
+ assert(local_path.empty() || local_path.back() != '/' ||
+ local_path.size() == 1 ||
+ (local_path.size() == 3 && local_path[1] == ':' &&
+ ((local_path[0] >= 'A' && local_path[0] <= 'Z') ||
+ (local_path[0] >= 'a' && local_path[0] <= 'z'))));
// If the path is already relative then just return the path.
if (!cmSystemTools::FileIsFullPath(remote_path)) {