1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-16 10:19:55 +00:00

Change default import prefix.

Changed from `(string path "/")` to
`(string (last (string/split "/" path)) "/)`.
This commit is contained in:
Calvin Rose 2020-01-24 16:54:06 -06:00
parent 163e2a5b22
commit 689f2dcbb4

View File

@ -2131,7 +2131,10 @@
:prefix prefix
:export ep} (table ;args))
(def newenv (require path ;args))
(def prefix (or (and as (string as "/")) prefix (string path "/")))
(def prefix (or
(and as (string as "/"))
prefix
(string (last (string/split "/" path)) "/")))
(loop [[k v] :pairs newenv :when (symbol? k) :when (not (v :private))]
(def newv (table/setproto @{:private (not ep)} v))
(put env (symbol prefix k) newv)))