code: @Nullable
    private DirectoryEntry lookUp(
        File dir, Iterable<Name> names, Set<? super LinkOption> options, int linkDepth)
        throws IOException {
      Iterator<Name> nameIterator = names.iterator();
      Name name = nameIterator.next();
      while (nameIterator.hasNext()) {
        Directory directory = toDirectory(dir);
        if (directory == null) {
          return null;
        }
  
        DirectoryEntry entry = directory.get(name);
        if (entry == null) {
          return null;
        }
  
        File file = entry.file();
        if (file.isSymbolicLink()) {
          DirectoryEntry linkResult = followSymbolicLink(dir, (SymbolicLink) file, linkDepth);
  
          if (linkResult == null) {
            return null;
          }
  
          dir = linkResult.fileOrNull();
        } else {
          dir = file;
        }
  
        name = nameIterator.next();
      }
  
      return lookUpLast(dir, name, options, linkDepth);
    }
docs: Looks up the given names against the given base file. If the file is not a directory, the
  lookup fails.