diff options
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index 4cb775ee..fe7e95e7 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -381,6 +381,7 @@ static public void load(String scriptbase, boolean failIfNotFound) throws Except String cljfile = scriptbase + ".clj"; URL classURL = baseLoader().getResource(classfile); URL cljURL = baseLoader().getResource(cljfile); + boolean failed = false; if(classURL != null && (cljURL == null @@ -405,7 +406,22 @@ static public void load(String scriptbase, boolean failIfNotFound) throws Except else loadResourceScript(RT.class, cljfile); } - else if(failIfNotFound) + else + { + try + { + Var.pushThreadBindings( + RT.map(CURRENT_NS, CURRENT_NS.get(), + WARN_ON_REFLECTION, WARN_ON_REFLECTION.get())); + failed = loadClassForName(scriptbase.replace('/','.') + LOADER_SUFFIX) == null; + } + finally + { + Var.popThreadBindings(); + } + } + + if(failed && failIfNotFound) throw new FileNotFoundException(String.format("Could not locate %s or %s on classpath: ", classfile, cljfile)); } |