diff options
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 601fd54..08a135f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -188,3 +188,20 @@ ctor::target_type target_type_from_extension(const std::filesystem::path& file) return ctor::target_type::unknown; } + +std::string esc(const std::string& in) +{ + std::string out; + for(auto c : in) + { + switch(c) + { + case '\\': out += "\\\\"; break; + case '"': out += "\\\""; break; + default: + out += c; + break; + } + } + return out; +} |