From 8d9a88e7594c319382939afb765fd75d29f15ac3 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 18 Feb 2019 15:31:15 -0500 Subject: [PATCH] Add JANET_PATH back in. --- janet.1 | 11 ++++++++++- src/mainclient/init.janet | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/janet.1 b/janet.1 index 4d052ca6..f29dadab 100644 --- a/janet.1 +++ b/janet.1 @@ -67,7 +67,7 @@ Quiet output. Don't print a repl prompt or expression results to stdout. .BR \-m\ syspath 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 -/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 .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 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 Written by Calvin Rose diff --git a/src/mainclient/init.janet b/src/mainclient/init.janet index 25fba0ca..8acf85ce 100644 --- a/src/mainclient/init.janet +++ b/src/mainclient/init.janet @@ -9,6 +9,8 @@ (var *handleopts* true) (var *exit-on-error* true) + (if-let [jp (os/getenv "JANET_PATH")] (set module/*syspath* jp)) + # Flag handlers (def handlers :private {"h" (fn [&]