mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 03:11:08 -06:00
cmOutputConverter: add a static version of EscapeForShell
This commit is contained in:
@@ -243,11 +243,6 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str,
|
||||
bool unescapeNinjaConfiguration,
|
||||
bool forResponse) const
|
||||
{
|
||||
// Do not escape shell operators.
|
||||
if (cmOutputConverterIsShellOperator(str)) {
|
||||
return std::string(str);
|
||||
}
|
||||
|
||||
// Compute the flags for the target shell environment.
|
||||
int flags = 0;
|
||||
if (this->GetState()->UseWindowsVSIDE()) {
|
||||
@@ -283,6 +278,16 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str,
|
||||
flags |= Shell_Flag_IsUnix;
|
||||
}
|
||||
|
||||
return cmOutputConverter::EscapeForShell(str, flags);
|
||||
}
|
||||
|
||||
std::string cmOutputConverter::EscapeForShell(cm::string_view str, int flags)
|
||||
{
|
||||
// Do not escape shell operators.
|
||||
if (cmOutputConverterIsShellOperator(str)) {
|
||||
return std::string(str);
|
||||
}
|
||||
|
||||
return Shell_GetArgument(str, flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public:
|
||||
bool forEcho = false, bool useWatcomQuote = false,
|
||||
bool unescapeNinjaConfiguration = false,
|
||||
bool forResponse = false) const;
|
||||
static std::string EscapeForShell(cm::string_view str, int flags);
|
||||
|
||||
enum class WrapQuotes
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user