docs: def glob(self):
          """Starts off the glob iterator."""
  
          # Cached symlinks
          self.symlinks = {}
  
          if self.is_bytes:
              curdir = os.fsencode(os.curdir)
          else:
              curdir = os.curdir
  
          for pattern in self.pattern:
              # If the pattern ends with `/` we return the files ending with `/`.
              dir_only = pattern[-1].dir_only if pattern else False
  
              if pattern:
                  if not pattern[0].is_magic:
                      # Path starts with normal plain text
                      # Lets verify the case of the starting directory (if possible)
                      this = pattern[0]
  
                      curdir = this[0]
  
                      if not os.path.lexists(curdir):
                          return
  
                      # Make sure case matches, but running case insensitive
                      # on a case sensitive file system may return more than
                      # one starting location.
                      results = [curdir] if this.is_drive else self._get_starting_paths(curdir)
                      if not results:
                          if not dir_only:
                              # There is no directory with this name,
                              # but we have a file and no directory restriction
                              yield curdir
                          return
  
                      if this.dir_only:
                          # Glob these directories if they exists
                          for start in results:
                              if os.path.isdir(start):
                                  rest = pattern[1:]
                                  if rest:
                                      this = rest.pop(0)
                                      for match in self._glob(curdir, this, rest):
                                          if not self._is_excluded(match, dir_only):
                                              yield os.path.join(match, self.empty) if dir_only else match
                                  elif not self._is_excluded(curdir, dir_only):
                                      yield os.path.join(curdir, self.empty) if dir_only else curdir
                      else:
                          # Return the file(s) and finish.
                          for start in results:
                              if os.path.lexists(start) and not self._is_excluded(start, dir_only):
                                  yield os.path.join(start, self.empty) if dir_only else start
                  else:
                      # Path starts with a magic pattern, let's get globbing
                      rest = pattern[:]
                      this = rest.pop(0)
                      for match in self._glob(curdir if not curdir == self.current else self.empty, this, rest):
                          if not self._is_excluded(match, dir_only):
                              yield os.path.join(match, self.empty) if dir_only else match