Optimize Stax icons table code generation

Now detects symlinks between glyphs to prevent duplicates
This commit is contained in:
Alexandre Paillier
2024-02-14 16:38:26 +01:00
parent bc0c29793a
commit 9b1b9f78bf

View File

@@ -4,6 +4,7 @@ import os
import sys
import re
import argparse
from pathlib import Path
class Network:
@@ -62,7 +63,10 @@ const network_icon_t g_network_icons[%u] = {\
for net in networks:
glyph_name = get_network_glyph_name(net)
if os.path.isfile("glyphs/%s.gif" % (glyph_name)):
glyph_file = "glyphs/%s.gif" % (glyph_name)
if os.path.isfile(glyph_file):
if os.path.islink(glyph_file):
glyph_name = Path(os.path.realpath(glyph_file)).stem
print(" "*4, end="", file=out)
print("{.chain_id = %u, .icon = &C_%s}, // %s" % (net.chain_id,
glyph_name,