Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] don't use scandir() to get directory contents (fix #18180)
  • Loading branch information
alexbruy committed Feb 23, 2018
1 parent 35cc4c9 commit a554409
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/plugins/processing/script/ScriptAlgorithmProvider.py
Expand Up @@ -99,11 +99,14 @@ def loadAlgorithms(self):
self.algs = []
folders = ScriptUtils.scriptsFolders()
for folder in folders:
items = os.scandir(folder)
items = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f))]
#items = os.scandir(folder)
for entry in items:
if entry.name.lower().endswith(".py") and entry.is_file():
moduleName = os.path.splitext(entry.name)[0]
filePath = os.path.abspath(os.path.join(folder, entry.name))
if entry.lower().endswith(".py"):
#if entry.name.lower().endswith(".py") and entry.is_file():
#moduleName = os.path.splitext(entry.name)[0]
moduleName = os.path.splitext(os.path.basename(entry))[0]
filePath = os.path.abspath(os.path.join(folder, entry))
alg = ScriptUtils.loadAlgorithm(moduleName, filePath)
if alg is not None:
self.algs.append(alg)
Expand Down

0 comments on commit a554409

Please sign in to comment.