1 21 22 package org.armedbear.lisp; 23 24 import java.io.File ; 25 import java.io.IOException ; 26 27 public final class probe_file extends Lisp 28 { 29 private static final Primitive1 PROBE_FILE = 32 new Primitive1("probe-file", "pathspec") 33 { 34 public LispObject execute(LispObject arg) throws ConditionThrowable 35 { 36 return Pathname.truename(arg, false); 37 } 38 }; 39 40 private static final Primitive1 TRUENAME = 43 new Primitive1("truename", "filespec") 44 { 45 public LispObject execute(LispObject arg) throws ConditionThrowable 46 { 47 return Pathname.truename(arg, true); 48 } 49 }; 50 51 private static final Primitive1 PROBE_DIRECTORY = 54 new Primitive1("probe-directory", PACKAGE_EXT, true) 55 { 56 public LispObject execute(LispObject arg) throws ConditionThrowable 57 { 58 Pathname pathname = Pathname.coerceToPathname(arg); 59 if (pathname.isWild()) 60 signal(new FileError("Bad place for a wild pathname.")); 61 File file = Utilities.getFile(pathname); 62 return file.isDirectory() ? Utilities.getDirectoryPathname(file) : NIL; 63 } 64 }; 65 66 private static final Primitive1 FILE_DIRECTORY_P = 69 new Primitive1("file-directory-p", PACKAGE_EXT, true) 70 { 71 public LispObject execute(LispObject arg) throws ConditionThrowable 72 { 73 Pathname pathname = Pathname.coerceToPathname(arg); 74 if (pathname.isWild()) 75 signal(new FileError("Bad place for a wild pathname.")); 76 File file = Utilities.getFile(pathname); 77 return file.isDirectory() ? T : NIL; 78 } 79 }; 80 } 81 | Popular Tags |