summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc17
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;
+}