Revision 57d56130 lib/utils.py

b/lib/utils.py
1715 1715
                 source=constants.LOCALHOST_IP_ADDRESS)
1716 1716

  
1717 1717

  
1718
def ListVisibleFiles(path):
1718
def ListVisibleFiles(path, sort=True):
1719 1719
  """Returns a list of visible files in a directory.
1720 1720

  
1721 1721
  @type path: str
1722 1722
  @param path: the directory to enumerate
1723
  @type sort: boolean
1724
  @param sort: whether to provide a sorted output
1723 1725
  @rtype: list
1724 1726
  @return: the list of all files not starting with a dot
1725 1727
  @raise ProgrammerError: if L{path} is not an absolue and normalized path
......
1729 1731
    raise errors.ProgrammerError("Path passed to ListVisibleFiles is not"
1730 1732
                                 " absolute/normalized: '%s'" % path)
1731 1733
  files = [i for i in os.listdir(path) if not i.startswith(".")]
1732
  files.sort()
1734
  if sort:
1735
    files.sort()
1733 1736
  return files
1734 1737

  
1735 1738

  

Also available in: Unified diff