1
0
mirror of https://github.com/janet-lang/janet synced 2025-07-27 22:32:53 +00:00

Pathing is not quite working...

This commit is contained in:
Calvin Rose 2024-05-25 16:00:43 -05:00
parent 8e0340252b
commit 14d1dc8749

View File

@ -24,20 +24,23 @@
(assert true) # smoke test (assert true) # smoke test
# Copy since not exposed in boot.janet # Copy since not exposed in boot.janet
(def- sep (if (= :windows (os/which)) "\\" "/"))
(defn- rmrf (defn- rmrf
"rm -rf in janet" "rm -rf in janet"
[x] [x]
(case (os/stat x :mode) (case (os/stat x :mode)
:file (os/rm x) :file (os/rm x)
:directory (do :directory (do
(each y (os/dir x) (rmrf (string x "/" y))) (each y (os/dir x) (rmrf (string x sep y)))
(os/rmdir x))) (os/rmdir x)))
nil) nil)
# Setup a temporary syspath for manipultation # Setup a temporary syspath for manipultation
(def syspath (string "./" (string (math/random)) "_jpm_tree.tmp")) (math/seedrandom (os/cryptorand 16))
(def syspath (string "." sep (string (math/random)) "_jpm_tree.tmp"))
(rmrf syspath) (rmrf syspath)
(os/mkdir syspath) (assert (os/mkdir syspath))
(print (os/
(put root-env *syspath* (os/realpath syspath)) (put root-env *syspath* (os/realpath syspath))
(setdyn *out* @"") (setdyn *out* @"")
(assert (empty? (bundle/list)) "initial bundle/list") (assert (empty? (bundle/list)) "initial bundle/list")