add path manipulation functions
This commit is contained in:
parent
a711b32730
commit
3b1ae0efd5
3 changed files with 24 additions and 2 deletions
|
|
@ -481,8 +481,6 @@ Note: this section will not show the status of each item unless you are viewing
|
|||
Note: this section only tracks the state of incomplete TODO items. Having everything on here would be cluttered.
|
||||
|
||||
** TODO Pre-alpha tasks
|
||||
- paths function
|
||||
- add-path function
|
||||
- Shell module
|
||||
- Only loadable via POSIX config var
|
||||
- Overload Load function to hook into this lib
|
||||
|
|
|
|||
|
|
@ -67,6 +67,21 @@
|
|||
(quote
|
||||
(not (contains? (1 2 3) 4))))
|
||||
|
||||
('get-paths properly splits path into segments'
|
||||
(quote
|
||||
(let ((PATH "/seg1:/seg2")
|
||||
(split-path (get-paths)))
|
||||
(and (eq? (len split-path) 2)
|
||||
(contains? split-path "/seg1")
|
||||
(contains? split-path "/seg2")))))
|
||||
|
||||
('add-path properly adds a new path segment to PATH'
|
||||
(quote
|
||||
(let ((PATH "/seg1:/seg2")
|
||||
(new-path "/seg3"))
|
||||
(add-path new-path)
|
||||
(contains? (get-paths) new-path))))
|
||||
|
||||
;; add more test cases here
|
||||
))
|
||||
|
||||
|
|
|
|||
|
|
@ -100,3 +100,12 @@ Returns true if the list contains the element.'
|
|||
(set (q found) true)
|
||||
(set (q list-iter) (pop remaining)))))
|
||||
found))
|
||||
|
||||
(def get-paths
|
||||
'returns each individual directory in PATH'
|
||||
() (split PATH ':'))
|
||||
|
||||
(def add-path
|
||||
'adds a directory to PATH'
|
||||
(path) (set (q PATH)
|
||||
(concat PATH ':' path)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue