Changeset 15403


Ignore:
Timestamp:
10/10/20 21:43:40 (2 years ago)
Author:
Mark Evenson
Message:

Our namestrings should always contain forward-slash delimited directories

We want to convert all Windows backslashes to this format on reading
namestrings, but always emit directories delimited with forward slashes.

TODO move away from using File.pathSeparator???

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

Legend:

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

    r15402 r15403  
    144144
    145145
    146   /** The path component separator used by internally generated
     146  /**
     147   * The path component separator used by internally generated
    147148   * path namestrings.
    148149   */
    149   public final static char separator = '/';
     150  public final static char directoryDelimiter = '/';
    150151   
    151152
     
    585586        // the namestring." 19.2.2.2.3.1
    586587        if (getDirectory() != NIL && getDirectory() != Keyword.UNSPECIFIC) {
    587             final char separatorChar = '/';
    588588            LispObject temp = getDirectory();
    589589            LispObject part = temp.car();
    590590            temp = temp.cdr();
    591591            if (part == Keyword.ABSOLUTE) {
    592                 sb.append(separatorChar);
     592                sb.append(directoryDelimiter);
    593593            } else if (part == Keyword.RELATIVE) {
    594594                if (temp == NIL) {
    595595                    // #p"./"
    596596                    sb.append('.');
    597                     sb.append(separatorChar);
     597                    sb.append(directoryDelimiter);
    598598                }
    599599                // else: Nothing to do.
     
    614614                    sb.append("..");
    615615                }
    616                 sb.append(separatorChar);
     616                sb.append(directoryDelimiter);
    617617                temp = temp.cdr();
    618618            }
     
    720720                    if (n.equals(".") || n.equals("..")) {
    721721                        useNamestring = false;
     722                        // ??? File.separatorChar is platform dependent.  Does this help on Windows?
    722723                    } else if (n.indexOf(File.separatorChar) >= 0) {
    723724                        useNamestring = false;
     
    21122113            String namestring = file.getCanonicalPath();
    21132114            if (namestring != null && namestring.length() > 0) {
     2115              // ??? do we really want the platform dependent separatorChar?
    21142116                if (namestring.charAt(namestring.length() - 1) != File.separatorChar) {
    21152117                    namestring = namestring.concat(File.separator);
  • trunk/abcl/src/org/armedbear/lisp/zip.java

    r15395 r15403  
    135135                  int i = 0;
    136136                  int j;
    137                   while ((j = d.indexOf(Pathname.separator, i)) != -1) {
     137                  while ((j = d.indexOf(Pathname.directoryDelimiter, i)) != -1) {
    138138                    i = j + 1;
    139                     directory = d.substring(0, j) + Pathname.separator;
     139                    directory = d.substring(0, j) + Pathname.directoryDelimiter;
    140140                    if (!directories.contains(directory)) {
    141141                      directories.add(directory);
     
    177177            int i = 0;
    178178            int j;
    179             while ((j = path.indexOf(Pathname.separator, i)) != -1) {
     179            while ((j = path.indexOf(Pathname.directoryDelimiter, i)) != -1) {
    180180                i = j + 1;
    181                 final String directory = path.substring(0, j) + Pathname.separator;
     181                final String directory = path.substring(0, j) + Pathname.directoryDelimiter;
    182182                if (!contains(directory)) {
    183183                    add(directory);
Note: See TracChangeset for help on using the changeset viewer.