summaryrefslogtreecommitdiffstats
path: root/Source/cmOutputConverter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmOutputConverter.cxx')
-rw-r--r--Source/cmOutputConverter.cxx81
1 files changed, 16 insertions, 65 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 411184c..630da42 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -46,68 +46,40 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
return this->ConvertToOutputFormat(remote, format);
}
-std::string cmOutputConverter::ConvertToOutputForExisting(
- RelativeRoot remote, OutputFormat format) const
-{
- // The relative root must have a path (i.e. not FULL or NONE)
- assert(remote != FULL);
- assert(remote != NONE);
-
- const char* remotePath = this->GetRelativeRootPath(remote);
- assert(remotePath != CM_NULLPTR);
-
- return this->ConvertToOutputForExisting(remotePath, format);
-}
-
-const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const
-{
- switch (relroot) {
- case HOME:
- return this->GetState()->GetSourceDirectory();
- case START:
- return this->StateSnapshot.GetDirectory().GetCurrentSource();
- case HOME_OUTPUT:
- return this->GetState()->GetBinaryDirectory();
- case START_OUTPUT:
- return this->StateSnapshot.GetDirectory().GetCurrentBinary();
- default:
- break;
- }
- return CM_NULLPTR;
-}
-
-std::string cmOutputConverter::Convert(const std::string& source,
- RelativeRoot relative,
- OutputFormat output) const
+std::string cmOutputConverter::ConvertToRelativePath(
+ const std::string& source, RelativeRoot relative) const
{
- // Convert the path to a relative path.
- std::string result = source;
+ std::string result;
switch (relative) {
case HOME:
result = this->ConvertToRelativePath(
- this->GetState()->GetSourceDirectoryComponents(), result);
+ this->GetState()->GetSourceDirectoryComponents(), source);
break;
case START:
result = this->ConvertToRelativePath(
this->StateSnapshot.GetDirectory().GetCurrentSourceComponents(),
- result);
+ source);
break;
case HOME_OUTPUT:
result = this->ConvertToRelativePath(
- this->GetState()->GetBinaryDirectoryComponents(), result);
+ this->GetState()->GetBinaryDirectoryComponents(), source);
break;
case START_OUTPUT:
result = this->ConvertToRelativePath(
this->StateSnapshot.GetDirectory().GetCurrentBinaryComponents(),
- result);
- break;
- case FULL:
- result = cmSystemTools::CollapseFullPath(result);
- break;
- case NONE:
+ source);
break;
}
+ return result;
+}
+
+std::string cmOutputConverter::Convert(const std::string& source,
+ RelativeRoot relative,
+ OutputFormat output) const
+{
+ // Convert the path to a relative path.
+ std::string result = this->ConvertToRelativePath(source, relative);
return this->ConvertToOutputFormat(result, output);
}
@@ -146,27 +118,6 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
return result;
}
-std::string cmOutputConverter::Convert(RelativeRoot remote,
- const std::string& local,
- OutputFormat output) const
-{
- // The relative root must have a path (i.e. not FULL or NONE)
- assert(remote != FULL);
- assert(remote != NONE);
-
- const char* remotePath = this->GetRelativeRootPath(remote);
- assert(remotePath != CM_NULLPTR);
-
- if (local.empty()) {
- 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)
{
return (cmSystemTools::ComparePath(a, b) ||