| 14 | } |
| 15 | |
| 16 | std::string ShellQuote(const std::string& str, char quote_char) |
| 17 | { |
| 18 | std::string result; |
| 19 | result += quote_char; |
| 20 | for (size_t i = 0; i < str.size(); ++i) { |
| 21 | if (str[i] == quote_char) |
| 22 | result += '\\'; |
| 23 | result += str[i]; |
| 24 | } |
| 25 | result += quote_char; |
| 26 | return result; |
| 27 | } |
| 28 | |
| 29 | std::string ShellQuoteIfNeed(const std::string& str, char quote_char) |
| 30 | { |