Fix T95962: Sapling Addon now broken because of license header

Load the first non-blank, non-comment line so files with licenses
are supported.
This commit is contained in:
Campbell Barton 2022-02-23 12:45:38 +11:00
parent 601b76c492
commit 593c699b2a
Notes: blender-bot 2023-02-14 18:23:47 +01:00
Referenced by issue #95962, Sapling Addon now broken because of "SPDX-License-Identifier" header
1 changed files with 4 additions and 1 deletions

View File

@ -182,7 +182,10 @@ class ImportData(Operator):
f = open(os.path.join(getPresetpaths()[0], self.filename), 'r')
except (FileNotFoundError, IOError):
f = open(os.path.join(getPresetpaths()[1], self.filename), 'r')
settings = f.readline()
# Find the first non-comment, non-blank line, this must contain preset text (all on one line).
for settings in f:
if settings and (not settings.startswith("#")):
break
f.close()
# print(settings)
settings = ast.literal_eval(settings)