()
| 1038 | } |
| 1039 | |
| 1040 | function getIconNames() { |
| 1041 | if (iconNamesCache) { |
| 1042 | return iconNamesCache; |
| 1043 | } |
| 1044 | |
| 1045 | try { |
| 1046 | const files = fs.readdirSync(S2_ICON_ROOT); |
| 1047 | const names = new Set(); |
| 1048 | |
| 1049 | for (const fileName of files) { |
| 1050 | if (!fileName.toLowerCase().endsWith('.svg')) { |
| 1051 | continue; |
| 1052 | } |
| 1053 | |
| 1054 | const normalized = fileName.replace(/^S2_Icon_(.*?)(Size\d+)?_2.*/, '$1'); |
| 1055 | const cleaned = normalized.trim(); |
| 1056 | if (cleaned) { |
| 1057 | names.add(cleaned); |
| 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | iconNamesCache = Array.from(names).sort((a, b) => a.localeCompare(b)); |
| 1062 | } catch { |
| 1063 | iconNamesCache = []; |
| 1064 | } |
| 1065 | |
| 1066 | return iconNamesCache; |
| 1067 | } |
| 1068 | |
| 1069 | function getIllustrationNames() { |
| 1070 | if (illustrationNamesCache) { |
no test coverage detected