Add JANET_PATH back in.

This commit is contained in:
Calvin Rose 2019-02-18 15:31:15 -05:00
parent 732de8f88d
commit 8d9a88e759
2 changed files with 12 additions and 1 deletions

11
janet.1
View File

@ -67,7 +67,7 @@ Quiet output. Don't print a repl prompt or expression results to stdout.
.BR \-m\ syspath .BR \-m\ syspath
Set the variable module/*syspath* to the string syspath so that Janet will load system modules Set the variable module/*syspath* to the string syspath so that Janet will load system modules
from a directory different than the default. The default is set when Janet is built, and defaults to from a directory different than the default. The default is set when Janet is built, and defaults to
/usr/local/lib/janet on Linux/Posix, and C:/Janet/Library on Windows. /usr/local/lib/janet on Linux/Posix, and C:/Janet/Library on Windows. This option supersedes JANET_PATH.
.TP .TP
.BR \-c\ source\ output .BR \-c\ source\ output
@ -86,5 +86,14 @@ or repl.
Stop parsing command line arguments. All arguments after this one will be considered file names Stop parsing command line arguments. All arguments after this one will be considered file names
and then arguments to the script. and then arguments to the script.
.SH ENVIRONMENT
.B JANET_PATH
.RS
The location to look for Janet libraries. This is the only environment variable Janet needs to
find native and source code modules. If no JANET_PATH is set, Janet will look in
the default location set at compile time.
.RE
.SH AUTHOR .SH AUTHOR
Written by Calvin Rose <calsrose@gmail.com> Written by Calvin Rose <calsrose@gmail.com>

View File

@ -9,6 +9,8 @@
(var *handleopts* true) (var *handleopts* true)
(var *exit-on-error* true) (var *exit-on-error* true)
(if-let [jp (os/getenv "JANET_PATH")] (set module/*syspath* jp))
# Flag handlers # Flag handlers
(def handlers :private (def handlers :private
{"h" (fn [&] {"h" (fn [&]