MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / tryLoadIconsFromDirectoryListing

Function tryLoadIconsFromDirectoryListing

app.js:2913–2934  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2911}
2912
2913async function tryLoadIconsFromDirectoryListing() {
2914 // Try known size folders; if they don't exist or listing is disabled, we'll fall back.
2915 const dirs = ["icons/16x16/", "icons/32x32/"];
2916 const all = [];
2917 for (const dir of dirs) {
2918 const sizeTag = dir.includes("16x16") ? "16x16" : (dir.includes("32x32") ? "32x32" : null);
2919 const files = await fetchDirListingPngFiles(dir);
2920 files.forEach((file) => {
2921 const rel = `${sizeTag}/${file}`;
2922 const name = normalizeIconNameFromFile(rel);
2923 all.push({
2924 file: rel,
2925 name,
2926 tags: [...inferTagsFromName(name), ...(sizeTag ? [sizeTag] : [])],
2927 url: buildIconUrl(rel)
2928 });
2929 });
2930 }
2931 // Sort for stable UI
2932 all.sort((a, b) => (a.file || "").localeCompare(b.file || ""));
2933 return all;
2934}
2935
2936function signatureForIcons(list) {
2937 return (list || []).map((i) => i.file).join("|");

Callers 1

loadFileIconsFunction · 0.85

Calls 4

fetchDirListingPngFilesFunction · 0.85
inferTagsFromNameFunction · 0.85
buildIconUrlFunction · 0.85

Tested by

no test coverage detected