Skip to content

Commit c901edb

Browse files
committed
Interpret an empty JANET_PATH as unset
This is a common idiom with environment variables, where a variable set to the empty string should behave the same as an unset variable.
1 parent 8fd1672 commit c901edb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/boot/boot.janet

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4634,11 +4634,12 @@
46344634
(var expect-image false)
46354635

46364636
(when-let [jp (getenv-alias "JANET_PATH")]
4637-
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
4638-
(def paths (reverse! (string/split path-sep jp)))
4639-
(for i 1 (length paths)
4640-
(module/add-syspath (get paths i)))
4641-
(setdyn *syspath* (first paths)))
4637+
(unless (empty? jp)
4638+
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
4639+
(def paths (reverse! (string/split path-sep jp)))
4640+
(for i 1 (length paths)
4641+
(module/add-syspath (get paths i)))
4642+
(setdyn *syspath* (first paths))))
46424643
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
46434644
(set colorize (and
46444645
(not (getenv-alias "NO_COLOR"))

0 commit comments

Comments
 (0)