diff options
-rw-r--r-- | stdlib/path-test.tl | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl index ceb83c3a..02fd0d55 100644 --- a/stdlib/path-test.tl +++ b/stdlib/path-test.tl @@ -180,24 +180,26 @@ (and (eql (logand st.mode sdir) sdir) (zerop st.uid)))) -(defun safe-abs-path (comps) - (flet ((digstr (s) [all s chr-isdigit])) - (let ((safe t)) - (when-match ("proc" @(or @(digstr) "self") . @rest) - (path-simplify comps) - (match-case rest - (@(or ("cwd" . @nil) - ("root" . @nil) - ("map_files" . @nil) - ("fd" @(digstr) . @nil)) - (zap safe)) - (("task" @(digstr) . @trest) - (match-case trest - (@(or ("cwd" . @nil) - ("root" . @nil) - ("fd" @(digstr) . @nil)) - (zap safe)))))) - safe))) +(if (starts-with "Linux" (uname).sysname) + (defun safe-abs-path (comps) + (flet ((digstr (s) [all s chr-isdigit])) + (let ((safe t)) + (when-match ("proc" @(or @(digstr) "self") . @rest) + (path-simplify comps) + (match-case rest + (@(or ("cwd" . @nil) + ("root" . @nil) + ("map_files" . @nil) + ("fd" @(digstr) . @nil)) + (zap safe)) + (("task" @(digstr) . @trest) + (match-case trest + (@(or ("cwd" . @nil) + ("root" . @nil) + ("fd" @(digstr) . @nil)) + (zap safe)))))) + safe))) + (set (symbol-function 'safe-abs-path) (fun tf))) (defun path-components-safe (path) (if-native-windows |