mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
[processing] don't use scandir() to get directory contents (fix #18180)
This commit is contained in:
parent
35cc4c902d
commit
a554409ede
@ -99,11 +99,14 @@ class ScriptAlgorithmProvider(QgsProcessingProvider):
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user