diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-17 16:36:19 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-11 21:57:53 (GMT) |
commit | 7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd (patch) | |
tree | c7f440ea9c81f49b066c9dd196ce705d288558d4 /Source/cmLocalGenerator.cxx | |
parent | 7ee56f03999e8605cc2cbe85a3a7b7159e639e5d (diff) | |
download | CMake-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.cxx | 12 |
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. |