浏览代码

cmOutputConverter::Convert: invert condition

Make the control flow of the 'optional' argument more explicit.
Daniel Pfeifer 9 年之前
父节点
当前提交
cde127b084
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      Source/cmOutputConverter.cxx

+ 6 - 6
Source/cmOutputConverter.cxx

@@ -168,14 +168,14 @@ std::string cmOutputConverter::Convert(RelativeRoot remote,
   const char* remotePath = this->GetRelativeRootPath(remote);
   assert(remotePath != 0);
 
-  if (!local.empty() && !optional) {
-    std::vector<std::string> components;
-    cmSystemTools::SplitPath(local, components);
-    std::string result = this->ConvertToRelativePath(components, remotePath);
-    return this->ConvertToOutputFormat(result, output);
+  if (local.empty() || optional) {
+    return this->ConvertToOutputFormat(remotePath, output);
   }
 
-  return this->ConvertToOutputFormat(remotePath, output);
+  std::vector<std::string> components;
+  cmSystemTools::SplitPath(local, components);
+  std::string result = this->ConvertToRelativePath(components, remotePath);
+  return this->ConvertToOutputFormat(result, output);
 }
 
 static bool cmOutputConverterNotAbove(const char* a, const char* b)