mirror of
https://github.com/janet-lang/janet
synced 2025-12-14 04:28:06 +00:00
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.
This commit is contained in:
@@ -4634,11 +4634,12 @@
|
|||||||
(var expect-image false)
|
(var expect-image false)
|
||||||
|
|
||||||
(when-let [jp (getenv-alias "JANET_PATH")]
|
(when-let [jp (getenv-alias "JANET_PATH")]
|
||||||
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
|
(unless (empty? jp)
|
||||||
(def paths (reverse! (string/split path-sep jp)))
|
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
|
||||||
(for i 1 (length paths)
|
(def paths (reverse! (string/split path-sep jp)))
|
||||||
(module/add-syspath (get paths i)))
|
(for i 1 (length paths)
|
||||||
(setdyn *syspath* (first paths)))
|
(module/add-syspath (get paths i)))
|
||||||
|
(setdyn *syspath* (first paths))))
|
||||||
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
|
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
|
||||||
(set colorize (and
|
(set colorize (and
|
||||||
(not (getenv-alias "NO_COLOR"))
|
(not (getenv-alias "NO_COLOR"))
|
||||||
|
|||||||
Reference in New Issue
Block a user