Skip to content

Commit 9b1b9f7

Browse files
Optimize Stax icons table code generation
Now detects symlinks between glyphs to prevent duplicates
1 parent bc0c297 commit 9b1b9f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/gen_networks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import re
66
import argparse
7+
from pathlib import Path
78

89

910
class Network:
@@ -62,7 +63,10 @@ def gen_icons_array_src(networks: list[Network], path: str) -> bool:
6263

6364
for net in networks:
6465
glyph_name = get_network_glyph_name(net)
65-
if os.path.isfile("glyphs/%s.gif" % (glyph_name)):
66+
glyph_file = "glyphs/%s.gif" % (glyph_name)
67+
if os.path.isfile(glyph_file):
68+
if os.path.islink(glyph_file):
69+
glyph_name = Path(os.path.realpath(glyph_file)).stem
6670
print(" "*4, end="", file=out)
6771
print("{.chain_id = %u, .icon = &C_%s}, // %s" % (net.chain_id,
6872
glyph_name,

0 commit comments

Comments
 (0)