Changeset 4046


Ignore:
Timestamp:
09/25/03 01:07:49 (19 years ago)
Author:
piso
Message:

USER-HOMEDIR-PATHNAME

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

Legend:

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

    r4033 r4046  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.73 2003-09-23 16:32:35 piso Exp $
     5 * $Id: Autoload.java,v 1.74 2003-09-25 01:07:49 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    231231        autoload("unexport", "PackageFunctions");
    232232        autoload("unuse-package", "PackageFunctions");
     233        autoload("user-homedir-pathname", "Pathname");
    233234        autoload(PACKAGE_SYS, "%define-condition", "define_condition");
    234235        autoload(PACKAGE_SYS, "%defpackage", "PackageFunctions");
  • trunk/j/src/org/armedbear/lisp/Pathname.java

    r3894 r4046  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Pathname.java,v 1.14 2003-09-19 14:44:10 piso Exp $
     5 * $Id: Pathname.java,v 1.15 2003-09-25 01:07:26 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    200200        }
    201201    };
     202
     203    // ### user-homedir-pathname
     204    // user-homedir-pathname &optional host => pathname
     205    private static final Primitive USER_HOMEDIR_PATHNAME =
     206        new Primitive("user-homedir-pathname")
     207    {
     208        public LispObject execute(LispObject[] args) throws ConditionThrowable
     209        {
     210            switch (args.length) {
     211                case 0: {
     212                    String s = System.getProperty("user.home");
     213                    // For compatibility with SBCL and ACL (and maybe other
     214                    // Lisps), we want the namestring of a directory to end
     215                    // with a '/' on Unix.
     216                    // FIXME Do we need to do something similar on Windows?
     217                    if (s.startsWith("/") {
     218                        // Unix.
     219                        if (!s.endsWith("/"))
     220                            s = s.concat("/");
     221                    }
     222                    return new Pathname(s);
     223                }
     224                case 1:
     225                    return NIL;
     226                default:
     227                    throw new ConditionThrowable(new WrongNumberOfArgumentsException(this));
     228            }
     229        }
     230    };
    202231}
Note: See TracChangeset for help on using the changeset viewer.