src/eric7/SystemUtilities/FileSystemUtilities.py

branch
eric7
changeset 9639
9e66fd88193c
parent 9624
b47dfa7a137d
child 9645
31aaa11672d3
--- a/src/eric7/SystemUtilities/FileSystemUtilities.py	Thu Dec 22 10:23:28 2022 +0100
+++ b/src/eric7/SystemUtilities/FileSystemUtilities.py	Thu Dec 22 19:46:37 2022 +0100
@@ -425,7 +425,12 @@
 
 
 def direntries(
-    path, filesonly=False, pattern=None, followsymlinks=True, checkStop=None
+    path,
+    filesonly=False,
+    pattern=None,
+    followsymlinks=True,
+    checkStop=None,
+    ignore=None,
 ):
     """
     Function returning a list of all files and directories.
@@ -442,26 +447,32 @@
     @type bool
     @param checkStop function to be called to check for a stop
     @type function
+    @param ignore list of entries to be ignored
+    @type list of str
     @return list of all files and directories in the tree rooted
         at path. The names are expanded to start with path.
     @rtype list of strs
     """
     patterns = pattern if isinstance(pattern, list) else [pattern]
     files = [] if filesonly else [path]
+    ignoreList = [
+        ".svn",
+        ".hg",
+        ".git",
+        ".ropeproject",
+        ".eric7project",
+        ".jedi",
+    ]
+    if ignore is not None:
+        ignoreList.extend(ignore)
+
     try:
         entries = os.listdir(path)
         for entry in entries:
             if checkStop and checkStop():
                 break
 
-            if entry in [
-                ".svn",
-                ".hg",
-                ".git",
-                ".ropeproject",
-                ".eric7project",
-                ".jedi",
-            ]:
+            if entry in ignoreList:
                 continue
 
             fentry = os.path.join(path, entry)

eric ide

mercurial