Changeset 10095


Ignore:
Timestamp:
10/12/05 18:40:22 (16 years ago)
Author:
piso
Message:

Work in progress (Windows).

Location:
trunk/j/src/org/armedbear/lisp
Files:
3 edited

Legend:

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

    r10086 r10095  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Pathname.java,v 1.101 2005-10-08 03:36:46 piso Exp $
     5 * $Id: Pathname.java,v 1.102 2005-10-12 18:38:38 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    257257            Debug.assertTrue(false);
    258258        FastStringBuffer sb = new FastStringBuffer();
     259        // "If a pathname is converted to a namestring, the symbols NIL and
     260        // :UNSPECIFIC cause the field to be treated as if it were empty. That
     261        // is, both NIL and :UNSPECIFIC cause the component not to appear in
     262        // the namestring." 19.2.2.2.3.1
    259263        if (host != NIL) {
    260264            Debug.assertTrue(host instanceof AbstractString);
     
    262266            sb.append(':');
    263267        }
     268        if (device == NIL)
     269            ;
     270        else if (device == Keyword.UNSPECIFIC)
     271            ;
     272        else if (device instanceof AbstractString) {
     273            sb.append(device.getStringValue());
     274            sb.append(':');
     275        } else if (device instanceof Pathname) {
     276            sb.append(((Pathname)device).getNamestring());
     277            sb.append("!");
     278        } else
     279            Debug.assertTrue(false);
    264280        sb.append(getDirectoryNamestring());
    265281        if (name instanceof AbstractString) {
     
    311327        // is, both NIL and :UNSPECIFIC cause the component not to appear in
    312328        // the namestring." 19.2.2.2.3.1
    313         if (device == NIL)
    314             ;
    315         else if (device == Keyword.UNSPECIFIC)
    316             ;
    317         else if (device instanceof AbstractString) {
    318             sb.append(device.getStringValue());
    319             sb.append(':');
    320         } else if (device instanceof Pathname) {
    321             sb.append(((Pathname)device).getNamestring());
    322             sb.append("!");
    323         } else
    324             Debug.assertTrue(false);
    325         final char separatorChar;
    326         if (device instanceof Pathname)
    327             separatorChar = '/'; // Jar file.
    328         else
    329             separatorChar = File.separatorChar;
    330329        if (directory != NIL) {
     330            final char separatorChar;
     331            if (device instanceof Pathname)
     332                separatorChar = '/'; // Jar file.
     333            else
     334                separatorChar = File.separatorChar;
    331335            LispObject temp = directory;
    332336            LispObject part = temp.car();
  • trunk/j/src/org/armedbear/lisp/tests/file-system-tests.lisp

    r10094 r10095  
    2424
    2525#+:sbcl (require '#:sb-posix)
     26
     27#+(and allegro mswindows)
     28(pushnew :windows *features*)
     29#+(and clisp win32)
     30(pushnew :windows *features*)
     31#+(and lispworks win32)
     32(pushnew :windows *features*)
    2633
    2734(unless (member "RT" *modules* :test #'string=)
     
    281288    (signals-error (probe-file pathname) 'file-error))
    282289  t)
     290#+(and clisp windows)
     291(pushnew 'probe-file.2 *expected-failures*)
    283292
    284293(deftest probe-file.3
     
    299308    (signals-error (probe-file pathname) 'file-error))
    300309  t)
     310#+(and clisp windows)
     311(pushnew 'probe-file.4 *expected-failures*)
    301312
    302313(deftest probe-file.5
     
    453464  (let ((pathname (user-homedir-pathname)))
    454465    (equal (namestring pathname) (directory-namestring pathname)))
    455   t)
     466  #-windows
     467  t
     468  #+windows
     469  ;; The drive prefix ("C:\\") is not part of the directory namestring.
     470  nil)
     471#+clisp
     472(pushnew 'directory-namestring.1 *expected-failures*)
     473
     474(deftest directory-namestring.2
     475  (let ((pathname (user-homedir-pathname)))
     476    (equal (directory-namestring pathname)
     477           (namestring (make-pathname :directory (pathname-directory pathname)))))
     478  t)
     479#+clisp
     480(pushnew 'directory-namestring.2 *expected-failures*)
    456481
    457482(deftest ensure-directories-exist.1
  • trunk/j/src/org/armedbear/lisp/tests/pathname-tests.lisp

    r10093 r10095  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: pathname-tests.lisp,v 1.44 2005-10-12 15:52:56 piso Exp $
     4;;; $Id: pathname-tests.lisp,v 1.45 2005-10-12 18:40:22 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    385385#+windows
    386386(deftest windows.1
     387  (equal #p"/foo/bar/baz" #p"\\foo\\bar\\baz")
     388  t)
     389
     390#+windows
     391(deftest windows.2
     392  (let ((pathname #p"foo.bar"))
     393    (check-windows-pathname pathname nil nil nil "foo" "bar"))
     394  t)
     395
     396#+windows
     397(deftest windows.3
     398  (let ((pathname #p"\\foo.bar"))
     399    (check-windows-pathname pathname nil nil '(:absolute) "foo" "bar"))
     400  t)
     401
     402#+windows
     403(deftest windows.4
    387404  (let ((pathname #p"c:\\foo.bar"))
    388405    #+(or abcl allegro)
    389     (check-windows-pathname #p"c:\\foo.bar" nil "c" '(:absolute) "foo" "bar")
     406    (check-windows-pathname pathname nil "c" '(:absolute) "foo" "bar")
    390407    #+clisp
    391     (check-windows-pathname #p"c:\\foo.bar" nil "C" '(:absolute) "foo" "bar")
     408    (check-windows-pathname pathname nil "C" '(:absolute) "foo" "bar")
    392409    #+lispworks
    393     (check-windows-pathname #p"c:\\foo.bar" "c" nil '(:absolute) "foo" "bar"))
     410    (check-windows-pathname pathname "c" nil '(:absolute) "foo" "bar"))
     411  t)
     412
     413#+windows
     414(deftest windows.5
     415  (equal #p"c:\\foo.bar" #p"C:\\FOO.BAR")
    394416  t)
    395417
Note: See TracChangeset for help on using the changeset viewer.