Fix T76849: Duplicate templates show in the New menu
This commit is contained in:
parent
98e18c41b6
commit
52d8b3a014
Notes:
blender-bot
2023-02-14 11:25:11 +01:00
Referenced by issue #76849, Startup file duplicated option
|
@ -316,16 +316,18 @@ class TOPBAR_MT_file_new(Menu):
|
|||
|
||||
template_paths = bpy.utils.app_template_paths()
|
||||
|
||||
# expand template paths
|
||||
app_templates = []
|
||||
# Expand template paths.
|
||||
|
||||
# Use a set to avoid duplicate user/system templates.
|
||||
# This is a corner case, but users managed to do it! T76849.
|
||||
app_templates = set()
|
||||
for path in template_paths:
|
||||
for d in os.listdir(path):
|
||||
if d.startswith(("__", ".")):
|
||||
continue
|
||||
template = os.path.join(path, d)
|
||||
if os.path.isdir(template):
|
||||
# template_paths_expand.append(template)
|
||||
app_templates.append(d)
|
||||
app_templates.add(d)
|
||||
|
||||
return sorted(app_templates)
|
||||
|
||||
|
|
Loading…
Reference in New Issue