예제 #1
0
 public Value apply(Value v1, Value v2) throws ContinuationException {
   switch (id) {
     case SETLASTMODIFIED:
       return SchemeBoolean.get(fileHandle(v1).setLastModified(((Quantity) v2).longValue()));
     case RENAME:
       return SchemeBoolean.get(fileHandle(v1).renameTo(fileHandle(v2)));
     default:
       throwArgSizeException();
   }
   return VOID;
 }
예제 #2
0
 public Value apply(Value v1) throws ContinuationException {
   switch (id) {
     case SETREADONLY:
       return SchemeBoolean.get(fileHandle(v1).setReadOnly());
     case DELETE:
       return SchemeBoolean.get(fileHandle(v1).delete());
     case MAKEDIRECTORY:
       return SchemeBoolean.get(fileHandle(v1).mkdir());
     case MAKEDIRECTORIES:
       return SchemeBoolean.get(fileHandle(v1).mkdirs());
     default:
       throwArgSizeException();
   }
   return VOID;
 }
예제 #3
0
 public Value apply(Value v1) throws ContinuationException {
   switch (id) {
     case DIRECTORYQ:
       return SchemeBoolean.get(fileHandle(v1).isDirectory());
     case FILEQ:
       return SchemeBoolean.get(fileHandle(v1).isFile());
     case HIDDENQ:
       return SchemeBoolean.get(fileHandle(v1).isHidden());
     case READABLE:
       return SchemeBoolean.get(fileHandle(v1).canRead());
     case WRITEABLE:
       return SchemeBoolean.get(fileHandle(v1).canWrite());
     case DIRLIST:
       Pair p = EMPTYLIST;
       String[] contents = fileHandle(v1).list();
       if (contents == null)
         throwPrimException(liMessage(IO.IOB, "nosuchdirectory", SchemeString.asString(v1)));
       for (int i = contents.length - 1; i >= 0; i--)
         p = new Pair(new SchemeString(contents[i]), p);
       return p;
     case LENGTH:
       return Quantity.valueOf(fileHandle(v1).length());
     case LASTMODIFIED:
       return Quantity.valueOf(fileHandle(v1).lastModified());
     case GETPARENTURL:
       try {
         return new SchemeString(fileHandle(v1).getParentFile().toURI().toURL().toString());
       } catch (MalformedURLException m) {
         m.printStackTrace();
       }
       break;
     default:
       throwArgSizeException();
   }
   return VOID;
 }