1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00

Use defdyn for syspath in boot.janet

This commit is contained in:
sogaiu 2022-04-13 19:39:41 +09:00
parent a2ba0913d3
commit bf9a60f70d

View File

@ -2208,10 +2208,13 @@
### ###
### ###
(defdyn *syspath*
"Path of directory to load system modules from.")
# Initialize syspath # Initialize syspath
(each [k v] (partition 2 (tuple/slice boot/args 2)) (each [k v] (partition 2 (tuple/slice boot/args 2))
(case k (case k
"JANET_PATH" (setdyn :syspath v))) "JANET_PATH" (setdyn *syspath* v)))
(defn make-env (defn make-env
`Create a new environment table. The new environment `Create a new environment table. The new environment
@ -3645,7 +3648,7 @@
(var error-level nil) (var error-level nil)
(var expect-image false) (var expect-image false)
(if-let [jp (getenv-alias "JANET_PATH")] (setdyn :syspath jp)) (if-let [jp (getenv-alias "JANET_PATH")] (setdyn *syspath* jp))
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile)) (if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
(defn- get-lint-level (defn- get-lint-level
@ -3690,7 +3693,7 @@
"i" (fn [&] (set expect-image true) 1) "i" (fn [&] (set expect-image true) 1)
"k" (fn [&] (set compile-only true) (set exit-on-error false) 1) "k" (fn [&] (set compile-only true) (set exit-on-error false) 1)
"n" (fn [&] (set colorize false) 1) "n" (fn [&] (set colorize false) 1)
"m" (fn [i &] (setdyn :syspath (in args (+ i 1))) 2) "m" (fn [i &] (setdyn *syspath* (in args (+ i 1))) 2)
"c" (fn c-switch [i &] "c" (fn c-switch [i &]
(def path (in args (+ i 1))) (def path (in args (+ i 1)))
(def e (dofile path)) (def e (dofile path))