def listdir_with_changed_status(self, d):
    """
    Lists contents of a dir, but only using its realpath.

    Returns tuple ([array of entries],changed)

    Changed is only True if the current directory changed. Will not change if the child directory changes.
    """
    if d in self.dirs:
      de = self.dirs[d]
      try:
        st_mtime = os.stat(d).st_mtime
      except OSError:
        st_mtime = 0
        del self.dirs[d]
        return ([], True)

      if st_mtime == de.st_mtime:
        return (de.ents, False)
      else:
        cur_ents = self.dirs[d].ents
        del self.dirs[d]
        new_ents = self.listdir_with_changed_status(d)[0]
        changed = set(new_ents) != set(cur_ents)
        return (new_ents, changed)
    else:
      # directory is not in cache...
      try:
        st = os.stat(d)
        st_mtime = st.st_mtime
        ents = os.listdir(d)
      except __HOLE__:
        return ([], False)

      ents = [e for e in ents if not self.is_ignored(e, os.path.join(d, e))]
      de = DirEnt(st_mtime, ents)
      self.dirs[d] = de
      return (de.ents, True)
dataset/ETHPy150Open natduca/quickopen/src/dir_cache.py/DirCache.listdir_with_changed_status