aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--environment.c2
-rw-r--r--stdlib/shell.c6
-rw-r--r--stdlib/shell.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/environment.c b/environment.c
index 78525b0f..9b39caa5 100644
--- a/environment.c
+++ b/environment.c
@@ -581,7 +581,7 @@ env_t *new_compilation_unit(CORD libname)
{"Int$value_as_text", "func(i:Int -> Path)"});
ADD_CONSTRUCTORS("Shell",
{"Shell$escape_text", "func(text:Text -> Shell)"},
- {"Shell$escape_text", "func(path:Path -> Shell)"},
+ {"Shell$escape_path", "func(path:Path -> Shell)"},
{"Shell$escape_text_array", "func(texts:[Text] -> Shell)"},
{"Shell$escape_text_array", "func(paths:[Path] -> Shell)"},
{"Int$value_as_text", "func(i:Int -> Shell)"});
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);