fixes bug for when a not open source license is selected

This commit is contained in:
alexzvk 2022-11-29 16:45:26 -05:00
parent b0699ce289
commit b869dc4dd9

View File

@ -331,6 +331,11 @@ def handle_licenses():
with open(os.path.join("licenses", "-temporary-placeholder.txt")) as f: with open(os.path.join("licenses", "-temporary-placeholder.txt")) as f:
selected_title = f.readline() selected_title = f.readline()
if selected_title == "Not open source":
os.remove("CONTRIBUTORS.txt")
shutil.rmtree("licenses")
return
with open(os.path.join("licenses", "licenses.json")) as f: with open(os.path.join("licenses", "licenses.json")) as f:
titles_dict = json.load(f) titles_dict = json.load(f)
# access the title to filename dictionary to find the correct file # access the title to filename dictionary to find the correct file
@ -342,8 +347,6 @@ def handle_licenses():
# +2 to get rid of the --- and and an extra new line # +2 to get rid of the --- and and an extra new line
f.writelines(contents[contents.index("---\n", 1) + 2:]) f.writelines(contents[contents.index("---\n", 1) + 2:])
if selected_title == "Not open source":
os.remove("CONTRIBUTORS.txt")
shutil.rmtree("licenses") shutil.rmtree("licenses")