summaryrefslogtreecommitdiffstats
path: root/stdlib/path-test.tl
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/path-test.tl')
-rw-r--r--stdlib/path-test.tl13
1 files changed, 13 insertions, 0 deletions
diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl
index fb132f7f..b3483962 100644
--- a/stdlib/path-test.tl
+++ b/stdlib/path-test.tl
@@ -185,3 +185,16 @@
(casequal ent
(("." ".."))
(t (return nil))))))))
+
+(defun path-search (name : (path (getenv "PATH")))
+ (if (empty name)
+ nil
+ (let ((pcomp (if (listp path)
+ path
+ (spl (if (starts-with "CYGNAL" (uname).sysname) #\; #\:)
+ path))))
+ (each ((pc pcomp))
+ (if (nequal pc "")
+ (let ((st (ignerr (stat (path-cat pc name)))))
+ (if (and st (path-executable-to-me-p st) (path-file-p st))
+ (return st.path))))))))