Example #1
0
  public boolean require(String file) {
    if (!runtime.getProfile().allowRequire(file)) {
      throw runtime.newLoadError("No such file to load -- " + file);
    }

    long startTime = loadTimer.startLoad(file);
    try {
      return smartLoad(file);
    } finally {
      loadTimer.endLoad(file, startTime);
    }
  }
Example #2
0
  public void load(String file, boolean wrap) {
    if (!runtime.getProfile().allowLoad(file)) {
      throw runtime.newLoadError("No such file to load -- " + file);
    }

    SearchState state = new SearchState(file);
    state.prepareLoadSearch(file);

    Library library = findBuiltinLibrary(state, state.searchFile, state.suffixType);
    if (library == null) library = findLibraryWithoutCWD(state, state.searchFile, state.suffixType);

    if (library == null) {
      library = findLibraryWithClassloaders(state, state.searchFile, state.suffixType);
      if (library == null) {
        throw runtime.newLoadError("No such file to load -- " + file);
      }
    }
    try {
      library.load(runtime, wrap);
    } catch (IOException e) {
      if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
      throw newLoadErrorFromThrowable(runtime, file, e);
    }
  }
Example #3
0
 public boolean require(String file) {
   if (!runtime.getProfile().allowRequire(file)) {
     throw runtime.newLoadError("No such file to load -- " + file);
   }
   return smartLoad(file);
 }