boolean (File file, int parentsToCheck, BuildRootDescriptor descriptor) { File current = file; while (parentsToCheck-- > 0) { current = FileUtil.getParentFile(current); if (!isDirectoryAccepted(current, descriptor)) { return false; } } return true; }