summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-01-17 16:36:19 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-11 21:57:53 (GMT)
commit7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd (patch)
treec7f440ea9c81f49b066c9dd196ce705d288558d4 /Source/cmLocalGenerator.cxx
parent7ee56f03999e8605cc2cbe85a3a7b7159e639e5d (diff)
downloadCMake-7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd.zip
CMake-7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd.tar.gz
CMake-7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd.tar.bz2
Convert loops populating maybe-empty content into the common pattern.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7afe05f..05d8ab5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3011,13 +3011,17 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// trailing slash in the input then the last iteration of the loop
// will add a slash followed by an empty string which will preserve
// the trailing slash in the output.
+
+ if(!relative.empty() && !remote.empty())
+ {
+ relative += "/";
+ }
+ const char* sep = "";
for(unsigned int i=common; i < remote.size(); ++i)
{
- if(!relative.empty())
- {
- relative += "/";
- }
+ relative += sep;
relative += remote[i];
+ sep = "/";
}
// Finally return the path.