mirror of
https://github.com/janet-lang/janet
synced 2025-10-06 19:42:29 +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)
|
||||
|
||||
(when-let [jp (getenv-alias "JANET_PATH")]
|
||||
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
|
||||
(def paths (reverse! (string/split path-sep jp)))
|
||||
(for i 1 (length paths)
|
||||
(module/add-syspath (get paths i)))
|
||||
(setdyn *syspath* (first paths)))
|
||||
(unless (empty? jp)
|
||||
(def path-sep (if (index-of (os/which) [:windows :mingw]) ";" ":"))
|
||||
(def paths (reverse! (string/split path-sep jp)))
|
||||
(for i 1 (length paths)
|
||||
(module/add-syspath (get paths i)))
|
||||
(setdyn *syspath* (first paths))))
|
||||
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
|
||||
(set colorize (and
|
||||
(not (getenv-alias "NO_COLOR"))
|
||||
|
Reference in New Issue
Block a user