Fix file loading from REPL
This commit is contained in:
parent
f8322412b7
commit
5653912f0e
|
@ -336,11 +336,13 @@
|
|||
|
||||
(defn- interpret-import [ast ctx]
|
||||
(let [path (:path ast)
|
||||
name (:name ast)]
|
||||
name (:name ast)
|
||||
file (ludus-resolve :file ctx)
|
||||
from (if (= ::not-found file) :cwd file)]
|
||||
(if (contains? @ctx name)
|
||||
(throw (ex-info (str "Name " name " is alrady bound") {:ast ast}))
|
||||
(let [source (try
|
||||
(loader/load-import path (ludus-resolve :file ctx))
|
||||
(loader/load-import path from)
|
||||
(catch Exception e
|
||||
(if (::loader/error (ex-data e))
|
||||
(throw (ex-info (ex-message e) {:ast ast}))
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
([file from]
|
||||
(load-import
|
||||
(fs/path
|
||||
(fs/parent (fs/canonicalize from))
|
||||
(if (= from :cwd) (fs/cwd) (fs/parent (fs/canonicalize from)))
|
||||
(fs/path file)))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user