Changeset 15439


Ignore:
Timestamp:
10/29/20 16:54:32 (2 years ago)
Author:
Mark Evenson
Message:

Teach our classloader about URLPathname objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java

    r15408 r15439  
    324324
    325325    protected static void addURL(JavaClassLoader jcl, LispObject jar) {
    326         if (jar instanceof Pathname) {
    327             jcl.addURL(((Pathname) jar).toURL());
    328         } else if (jar instanceof AbstractString) {
    329           jcl.addURL(((Pathname)Pathname.create(jar.toString())).toURL());
     326      URLPathname urlPathname = null;
     327      if (jar instanceof URLPathname) {
     328        urlPathname = (URLPathname)jar;
     329      } else if (jar instanceof Pathname) {
     330        urlPathname = URLPathname.createFromFile((Pathname)jar);
     331      } else if (jar instanceof AbstractString) {
     332        String namestring = jar.getStringValue();
     333        if (!Pathname.isValidURL(namestring)) {
     334          Pathname p = Pathname.create(namestring);
     335          if (p != null) {
     336            urlPathname = URLPathname.create(p);
     337          }
    330338        } else {
    331             error(new TypeError(jar + " must be a pathname designator"));
    332         }
     339          urlPathname = URLPathname.create(namestring);
     340        }
     341      }
     342      if (urlPathname == null) {
     343        error(new TypeError(jar + " must be a pathname designator"));
     344      }
     345      jcl.addURL(urlPathname.toURL());
    333346    }
    334347
Note: See TracChangeset for help on using the changeset viewer.