rt/vm/src/main/java/org/apidesign/vm4brwsr/VMLazy.java
changeset 1282 8d29792a09c6
parent 869 151f4ccd7673
child 1367 6193e735f4d1
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VMLazy.java	Thu Mar 21 18:48:46 2013 +0100
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VMLazy.java	Thu Sep 12 14:15:47 2013 +0200
     1.3 @@ -130,6 +130,14 @@
     1.4  
     1.5          @Override
     1.6          protected void requireScript(String resourcePath) throws IOException {
     1.7 +            if (!resourcePath.startsWith("/")) {
     1.8 +                resourcePath = "/" + resourcePath;
     1.9 +            }
    1.10 +            String code = readCode(resourcePath);
    1.11 +            applyCode(lazy.loader, null, code, false);
    1.12 +        }
    1.13 +
    1.14 +        private String readCode(String resourcePath) throws IOException {
    1.15              InputStream is = getClass().getResourceAsStream(resourcePath);
    1.16              StringBuilder sb = new StringBuilder();
    1.17              for (;;) {
    1.18 @@ -139,7 +147,7 @@
    1.19                  }
    1.20                  sb.append((char)ch);
    1.21              }
    1.22 -            applyCode(lazy.loader, null, sb.toString(), false);
    1.23 +            return sb.toString();
    1.24          }
    1.25  
    1.26          @Override