diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-11-02 04:36:37 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2019-11-02 06:54:13 (GMT) |
commit | 0692eaf0fe00fd4bd90c2a4f107356b2bc0f9d99 (patch) | |
tree | c8b68b4c4f8d4cfc1c91ed6ec33095df5df5ba8e /Source/cmSystemTools.cxx | |
parent | c1d5d5eb11e0260ffadda0851ac844ab46b6b179 (diff) | |
download | CMake-0692eaf0fe00fd4bd90c2a4f107356b2bc0f9d99.zip CMake-0692eaf0fe00fd4bd90c2a4f107356b2bc0f9d99.tar.gz CMake-0692eaf0fe00fd4bd90c2a4f107356b2bc0f9d99.tar.bz2 |
ForceToRelativePath: Fix spurious assertion when local path is root dir
Fixes: #19909
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 9 |
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)) { |