Changeset 15448


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

Fix ANSI TEST DIRECTORY.8

Static methods need to explicitly check type

When merging with JarPathname? as default the directory is always absolute

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r15445 r15448  
    5454  }
    5555
    56   protected static Pathname create(Pathname p) {
     56  public static Pathname create(Pathname p) {
    5757    if (p instanceof JarPathname) {
    58       return (JarPathname)JarPathname.create(p.getNamestring());
     58      return JarPathname.create((JarPathname)p);
    5959    } else if (p instanceof URLPathname) {
    60       return (URLPathname)URLPathname.create(((URLPathname)p).getNamestringAsURL());
     60      return URLPathname.create((URLPathname)p);
     61    } else if (p instanceof LogicalPathname) {
     62      return LogicalPathname.create((LogicalPathname)p);
    6163    } else {
    62       return new Pathname(p);
     64      return new Pathname((Pathname)p);
    6365    }
    6466  }
     
    17291731      } else {
    17301732        result.setDirectory(mergeDirectories(p.getDirectory(), d.getDirectory()));
     1733        // Directories are always absolute in a JarPathname
     1734        if (result instanceof JarPathname) {
     1735          LispObject directories = result.getDirectory();
     1736          if ((!directories.car().equals(NIL))
     1737              && directories.car().equals(Keyword.RELATIVE)) {
     1738            directories = directories.cdr().push(Keyword.ABSOLUTE);
     1739            result.setDirectory(directories);
     1740          }
     1741        }
    17311742      }
    17321743     
  • trunk/abcl/src/org/armedbear/lisp/URLPathname.java

    r15441 r15448  
    6060
    6161  public static URLPathname create(Pathname p) {
     62    if (p instanceof URLPathname) {
     63      URLPathname result = new URLPathname();
     64      result.copyFrom(p);
     65      return result;
     66    }
    6267    return (URLPathname)createFromFile((Pathname)p);
    63   }
    64 
    65   public static URLPathname create(URLPathname p) {
    66     URLPathname result = new URLPathname();
    67     result.copyFrom(p);
    68     return result;
    6968  }
    7069
     
    230229 
    231230  static public boolean hasExplicitFile(Pathname p) {
     231    if (!p.getHost().listp()) {
     232        return false;
     233    }
    232234    LispObject scheme = Symbol.GETF.execute(p.getHost(), SCHEME, NIL);
    233235    return scheme.equalp(FILE);
Note: See TracChangeset for help on using the changeset viewer.