diff options
author | Raphaƫl Garnier <garnier.raphael@gmail.com> | 2015-02-23 23:33:07 +0100 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2015-02-27 13:40:15 +0100 |
commit | 2960f96c497f75883a8e03b5983ddd10ed570caf (patch) | |
tree | 0b1fcc4d2c7761e0d2bead101c486d4ecf77bbbb | |
parent | 1105ed0acb5b3111c6c711fe481372b1f7f3687e (diff) | |
download | gwtquery-2960f96c497f75883a8e03b5983ddd10ed570caf.tar.gz gwtquery-2960f96c497f75883a8e03b5983ddd10ed570caf.zip |
Use absolute path to load library in JsniBundle
As ClientBundle do, it's now possible to use relative or absolute path
to load js libraries in JsniBundle.
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java index cfd9893e..eb1511e4 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsniBundleGenerator.java @@ -131,11 +131,16 @@ public class JsniBundleGenerator extends Generator { try { if (!src.matches("(?i)https?://.*")) { String file = path + "/" + src; - logger.log(TreeLogger.INFO, getClass().getSimpleName() - + " - importing external javascript: " + file); - in = this.getClass().getClassLoader().getResourceAsStream(file); if (in == null) { + // If we didn't find the resource relative to the package, assume it is absolute. + file = src; + in = this.getClass().getClassLoader().getResourceAsStream(file); + } + if (in != null) { + logger.log(TreeLogger.INFO, getClass().getSimpleName() + + " - importing external javascript: " + file); + } else { logger.log(TreeLogger.ERROR, "Unable to read javascript file: " + file); } } else { |