Write icon entries to manifest only if changed
This commit is contained in:
parent
629062ea26
commit
304bd86220
|
@ -32,15 +32,16 @@ def update_icon_entries(silent=False):
|
||||||
config_dir = get_script_dir()
|
config_dir = get_script_dir()
|
||||||
config_path = os.path.join(config_dir, "limboai.gdextension")
|
config_path = os.path.join(config_dir, "limboai.gdextension")
|
||||||
content = ""
|
content = ""
|
||||||
|
new_content = ""
|
||||||
|
|
||||||
f = open(config_path, "r")
|
f = open(config_path, "r")
|
||||||
for line in f:
|
for line in f:
|
||||||
if line.startswith("[icons]"):
|
|
||||||
break
|
|
||||||
content += line
|
content += line
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
content += "[icons]\n\n"
|
index = content.find("[icons]")
|
||||||
|
new_content = content[0:index]
|
||||||
|
new_content += "[icons]\n\n"
|
||||||
|
|
||||||
icon_files = []
|
icon_files = []
|
||||||
icons_dir = os.path.join(config_dir, "../icons/")
|
icons_dir = os.path.join(config_dir, "../icons/")
|
||||||
|
@ -50,15 +51,18 @@ def update_icon_entries(silent=False):
|
||||||
|
|
||||||
icon_files.sort()
|
icon_files.sort()
|
||||||
for icon_file in icon_files:
|
for icon_file in icon_files:
|
||||||
content += os.path.splitext(icon_file)[0] + ' = "res://addons/limboai/icons/' + icon_file + '"\n'
|
new_content += os.path.splitext(icon_file)[0] + ' = "res://addons/limboai/icons/' + icon_file + '"\n'
|
||||||
|
|
||||||
f = open(config_path, "w")
|
if new_content != content:
|
||||||
f.write(content)
|
f = open(config_path, "w")
|
||||||
f.close()
|
f.write(new_content)
|
||||||
|
f.close()
|
||||||
if not silent:
|
if not silent:
|
||||||
print(content)
|
print(new_content)
|
||||||
print("======= Icon entries updated =======")
|
print("=== Icon entries updated ===")
|
||||||
|
else:
|
||||||
|
if not silent:
|
||||||
|
print("=== No update needed for icon entries ===")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue