@Override public int getBooleanAttributes(File f) { int attributes = 0; attributes |= (VMFile.exists(f.getPath()) ? BA_EXISTS : 0); attributes |= (VMFile.isFile(f.getPath()) ? BA_REGULAR : 0); attributes |= (VMFile.isDirectory(f.getPath()) ? BA_DIRECTORY : 0); attributes |= (VMFile.isHidden(f.getPath()) ? BA_HIDDEN : 0); return attributes; }
@Override public boolean checkAccess(File f, int access) { boolean canAccess; if (!VMFile.exists(f.getPath())) return false; switch (access) { case ACCESS_READ: canAccess = VMFile.canRead(f.getPath()); break; case ACCESS_WRITE: if (VMFile.isDirectory(f.getPath())) canAccess = VMFile.canWriteDirectory(f); else canAccess = VMFile.canWrite(f.getPath()); break; case ACCESS_EXECUTE: canAccess = VMFile.canExecute(f.getPath()); break; default: throw new IllegalArgumentException("invalid access : " + access); } return canAccess; }