aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/shell.c6
-rw-r--r--stdlib/shell.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/stdlib/shell.c b/stdlib/shell.c
index 7c54950c..7dcc9a0a 100644
--- a/stdlib/shell.c
+++ b/stdlib/shell.c
@@ -6,6 +6,7 @@
#include "arrays.h"
#include "integers.h"
+#include "paths.h"
#include "patterns.h"
#include "shell.h"
#include "text.h"
@@ -17,6 +18,11 @@ public Shell_t Shell$escape_text(Text_t text)
return Texts(Text("'"), Text$replace(text, Text("'"), Text("'\"'\"'"), Text(""), false), Text("'"));
}
+public Shell_t Shell$escape_path(Path_t path)
+{
+ return Shell$escape_text(Path$as_text(&path, false, &Path$info));
+}
+
public Shell_t Shell$escape_text_array(Array_t texts)
{
Array_t all_escaped = {};
diff --git a/stdlib/shell.h b/stdlib/shell.h
index 500bb043..c20c809d 100644
--- a/stdlib/shell.h
+++ b/stdlib/shell.h
@@ -18,6 +18,7 @@
OptionalClosure_t Shell$by_line(Shell_t command);
Shell_t Shell$escape_text(Text_t text);
+Shell_t Shell$escape_path(Path_t path);
Shell_t Shell$escape_text_array(Array_t texts);
OptionalArray_t Shell$run_bytes(Shell_t command);
OptionalText_t Shell$run(Shell_t command);